⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

primary_key problem



Hamed
  • profile picture
  • Member

Posted 15 February 2013 - 07:12 AM

When I want to see list I get :

( ! ) Fatal error: Cannot access empty property in C:\wamp\www\application\libraries\grocery_crud.php on line 1446
Call Stack
#    Time    Memory    Function    Location
1    0.0006    157496    {main}( )    ..\index.php:0
2    0.0017    193760    require_once( 'C:\wamp\www\system\core\CodeIgniter.php' )    ..\index.php:202
3    0.1399    2911424    call_user_func_array ( )    ..\CodeIgniter.php:359
4    0.1399    2911472    Matlab->index( )    ..\CodeIgniter.php:359
5    0.1402    2924896    grocery_CRUD->render( )    ..\matlab.php:62
6    0.1530    3041776    grocery_CRUD_Layout->showList( )    ..\grocery_crud.php:3926

 

 

I test $data I see primary_key is empty.

What should I do?


Hamed
  • profile picture
  • Member

Posted 15 February 2013 - 11:53 AM

( ! ) Fatal error: Uncaught exception 'Exception' with message 'It is impossible to get data. Please check your model and try again.' in C:\wamp\www\application\libraries\grocery_crud.php on line 1440
( ! ) Exception: It is impossible to get data. Please check your model and try again. in C:\wamp\www\application\libraries\grocery_crud.php on line 1440

Also I get this error


victor
  • profile picture
  • Member

Posted 16 February 2013 - 20:37 PM

show your code and structure of your table

goFrendiAsgard
  • profile picture
  • Member

Posted 17 February 2013 - 02:17 AM

First, how do you get that "call stack"? it is kinda cool :)
Are you sure with the columns and tables name?
And can you make sure that the primary key of every tables are integer and autoincrement?


Hamed
  • profile picture
  • Member

Posted 22 February 2013 - 06:15 AM

    public function votes() {
        $crud = new grocery_CRUD();
        $crud->set_theme('flexigrid');
        $crud->set_table('votes');
        $crud->set_subject('گزینه');
        $crud->display_as('pid', 'عنوان نظر سنجی');
        $crud->display_as('text', 'گزینه');
        $crud->display_as('total', 'تعداد رای');
        $crud->columns('pid', 'text', 'total');
        $crud->set_relation('pid', 'polls', 'title');
        $crud->change_field_type('time', 'hidden', time());
        $crud->callback_after_insert(array($this, 'clear_cache'));
        $crud->callback_after_update(array($this, 'clear_cache'));
        $crud->callback_after_delete(array($this, 'clear_cache'));
        $output = $crud->render();
        $this->load->view('admin/matlab/votes', $output);
    }

 

CREATE TABLE IF NOT EXISTS `votes` (
  `vid` int(30) NOT NULL AUTO_INCREMENT,
  `pid` int(30) NOT NULL,
  `text` varchar(500) NOT NULL,
  `total` int(30) NOT NULL DEFAULT '0',
  PRIMARY KEY (`vid`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

This is simple table and CRUD code.

I have this problem with all tables and CRUD.


victor
  • profile picture
  • Member

Posted 22 February 2013 - 19:19 PM

Try update the library, maybe the problem in it?

davidoster
  • profile picture
  • Member

Posted 22 February 2013 - 20:02 PM

Where is the field for the field `time` within your SQL table?

$crud->change_field_type('time', 'hidden', time());


Hamed
  • profile picture
  • Member

Posted 01 April 2013 - 12:37 PM

I update library.

I have this problem in all CRUD.
 


Hamed
  • profile picture
  • Member

Posted 03 April 2013 - 08:04 AM

No one can help me?


davidoster
  • profile picture
  • Member

Posted 03 April 2013 - 09:08 AM

Are you sure that the connection settings are correct on application/config/database.php?

 

Have you tried to setup the default examples that come with Grocery CRUD and see if everything works as it is supposed to be?

 

Where do you run your code?

 

localhost or on a public server?


bgarness
  • profile picture
  • Member

Posted 18 April 2013 - 20:31 PM

I am getting the same error when attempting to use gcrud to render a table with 1.3 million records..... I can render any other table in my db; however, this massive table just kills my gcrud :-(    

 

Please let me know if anyone has some advice on using gcrud w/ massive myisam tables lol

 

Finest Regards

 

 

 

 

######

Apache Error Log

 

 
[Thu Apr 18 16:27:42 2013] [error] [client 192.168.42.23] PHP Fatal error:  Cannot access empty property in /var/www/brad/ams/application/libraries/grocery_crud.php on line 1441
 
 
 
######
Gcrud Controller...
 
 
/*---------------------------------------------------------------------------------------------------- PUBLIC FUNCTION    ::   landdaily */
    public function landdaily(){
        $crud = new grocery_CRUD();
        $crud->set_table('land_daily');
        $crud->set_subject('Daily');
        $output = $crud->render();
            $this->view('ams_mgmt/gcrud_template', $output, 'ams_mgmt_index');
            $this->output->enable_profiler(TRUE);                                                                                            // CI DEBUGGER
    }
 
 
 
 
All works well if i simply switch the table name.... But I cannot render this massive table haha!