⚠ 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

Bug? - Call to a member function result()



Paks

Paks
  • profile picture
  • Member

Posted 06 January 2012 - 00:36 AM

First of all... sorry by mi english... with that being said, i will try to expose my case.

I am receiving the next error



[color=#000000][font=Arial, Helvetica, sans-serif][size=2]
[b]Fatal error[/b]: Call to a member function result() on a non-object in [b]/htdocs/public/www/application/models/grocery_model.php[/b] on line [b]45[/b][/size][/font][/color]


This happens to me only with the flexigrid theme.

I can see how the data is loaded ok, but then, at the bottom of the flexigrid theme, there is a spinner, i don't know how it works, may be is making some kind of request to the groceryCrud to validate the amount left, or loading more data... i don't know, but after i can see the data, it gets removed and the message is shown.

The line of code in grocery_model is

$results = $this->db->get($this->table_name)->result();



The most weird part is that i have another table, that work just as expected, and in my local system both are working fine.

I try to change the table in the controller that works by the one that doesn't but with no luck at all, same error. Tried to dump de data and delete the table and upload it agani... even try to wipe out the entire code and upload it agan and the error persist.

I change the theme to datatables and work fine... i think this is just personal! i need to know what is going wrong.

So please, any kind of help will be much welcome, on how to track the problem or if some one has experience the same issue. I just hope that this is not a lame error bye me.

If you need more info i will be glad to give the adress and the source.

Thanks in advances and btw... awesome work!

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 06 January 2012 - 07:27 AM

[quote name='Paks' timestamp='1325810180' post='227']
First of all... sorry by mi english... with that being said, i will try to expose my case.

I am receiving the next error




[color=#000000][font=Arial, Helvetica, sans-serif][size=2][b]Fatal error[/b]: Call to a member function result() on a non-object in [b]/htdocs/public/www/application/models/grocery_model.php[/b] on line [b]45[/b][/size][/font][/color]


This happens to me only with the flexigrid theme.

I can see how the data is loaded ok, but then, at the bottom of the flexigrid theme, there is a spinner, i don't know how it works, may be is making some kind of request to the groceryCrud to validate the amount left, or loading more data... i don't know, but after i can see the data, it gets removed and the message is shown.

The line of code in grocery_model is

$results = $this->db->get($this->table_name)->result();



The most weird part is that i have another table, that work just as expected, and in my local system both are working fine.

I try to change the table in the controller that works by the one that doesn't but with no luck at all, same error. Tried to dump de data and delete the table and upload it agani... even try to wipe out the entire code and upload it agan and the error persist.

I change the theme to datatables and work fine... i think this is just personal! i need to know what is going wrong.

So please, any kind of help will be much welcome, on how to track the problem or if some one has experience the same issue. I just hope that this is not a lame error bye me.

If you need more info i will be glad to give the adress and the source.

Thanks in advances and btw... awesome work!
[/quote]

This is really weird and propably it is personal problem. Can you send the function that you run and using grocery CRUD? For example something like this:

function my_boss_is_in_a_hurry()
{
$this->grocery_crud->set_table('customers');
$this->grocery_crud->columns('customerName','phone','addressLine1','creditLimit');

$output = $this->grocery_crud->render();

$this->_example_output($output);
}

It doesn't make sense to work only with datatables because the model is the same on both themes.

Paks

Paks
  • profile picture
  • Member

Posted 06 January 2012 - 08:47 AM

Hello Johnny... awesome work you are doing here

I am with you... i don't think this is a model problem

This is the code you are asking for


public function index()
{
$this->layout_library->add_menu($this->menu_list, 'Noticias');
$this->grocery_crud->set_table('noticias');

$output = $this->grocery_crud->render();


$this->layout_library->view('cms_crud_view', $output, 'cms_crud_layout');
}



To make more sense of what happend, i leave here the results of the render

At first... everithing is ok

[img]https://img.skitch.com/20120106-gx98ydn1ww2dyb1j4epgxw9idi.jpg[/img]


After a second or less... it looks likes there is another query (sorry for my ignorance if is not the case) and the content changes and now appears

[img]https://img.skitch.com/20120106-xuc1qpd9xhy433ekbuk87xuhh3.jpg[/img]

The number line is different to 45 because in that case i just try to make some debug, with no success.

Also, i translate to spanish, when i fully tested the language i can send it to you.

Thanks!

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 06 January 2012 - 21:14 PM

It's really weird and I think that its a known issue at: http://www.grocerycr...ew/known-issues . First of all try to move your function to another one and see if this works. So with the index there are sometimes problem with this, so for example move it to:

public function noticias()
{
$this->layout_library->add_menu($this->menu_list, 'Noticias');
$this->grocery_crud->set_table('noticias');
$output = $this->grocery_crud->render();

$this->layout_library->view('cms_crud_view', $output, 'cms_crud_layout');
}


If this doesn't work please check the $db['default']['dbprefix'] is set to FALSE.

If this doesn't work delete all your cache and your cookies and run again the function (See image below)
[attachment=13:2012-01-06_211635.png]

If still doesn't work try to debug the query: Go to application/config/database.php and change the
$db['default']['db_debug'] to TRUE; so it will be:


$db['default']['db_debug'] = TRUE;


We'll see at least the error of the database that occures at least and we figure out the solution ;)

Paks

Paks
  • profile picture
  • Member

Posted 06 January 2012 - 21:39 PM

I don't know what i did but somehow now is working like a charm.

I move everything to a single controller, and all the problems are solved! the more probable scenario is that i mess up something, so i restart with a different approach making one single controller for all the admin (so easy with groceryCRUD!) and that worked quite well... may be is what you say in your post, about to move to a function different from index, now in the index i only have the welcome screen.

Once again, thank you very much for your support, your patience and your code. I hope i can give you something back with a donation if finally i get paid with that, and in every project i use your awesome library, you absolutely deserve it.

Thanks!