0

I have the following code that has been working perfectly for a few months, and all of a sudden it has stopped working. I checked the query being run and it is working correctly and getting the intended results.

This is the code:

$this->db->where('user', $user);
$this->db->select_max('id', 'max_id');
$query1 = $this->db->get('offers');

$result = $query1->row();

This is the error:

Fatal error: Call to a member function row() on a non-object
Dan
  • 224
  • 2
  • 11
  • You porbably have an sql error and `db_debug` disabled in `application/config/database.php`. In that case the `->get()` will just return `false`. Do you get any error with `db_debug` enabled? – complex857 Apr 02 '13 at 20:54
  • Good call! It looks like there is an error: Error Number: 2006 MySQL server has gone away – Dan Apr 02 '13 at 20:57
  • http://stackoverflow.com/questions/1980004/2006-mysql-server-has-gone-away-error-in-wamp – WebNovice Apr 02 '13 at 21:31
  • I had some problems with a similar error that occurred occasionally on my local host. It seemed to be caused by persistant connection to the database. I solved it by setting pconnect to false in the database.php config file. – Jeemusu Apr 03 '13 at 04:42

0 Answers0