Jump to content


Bug? - Call to a member function result()

bug question

  • Please log in to reply
4 replies to this topic

#1 Paks

Paks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 06 January 2012 - 12: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




Fatal error: Call to a member function result() on a non-object in /htdocs/public/www/application/models/grocery_model.php on line 45



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!

#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,150 posts
  • LocationLondon

Posted 06 January 2012 - 07:27 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




Fatal error: Call to a member function result() on a non-object in /htdocs/public/www/application/models/grocery_model.php on line 45


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!


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.
Posted Image

#3 Paks

Paks

    Newbie

  • Members
  • Pip
  • 5 posts

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

Posted Image


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

Posted Image

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!

#4 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,150 posts
  • LocationLondon

Posted 06 January 2012 - 09: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)
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 ;)
Posted Image

#5 Paks

Paks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 06 January 2012 - 09: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!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users