0

Possible Duplicate:
Fatal error: Call to a member function fetch_assoc() on a non-object

I have the following code:

$this->open_connection();
$result = $this->connection->query($this->query);           
while($this->rows[] = $result->fetch_assoc()){}                     
$result->close();
$this->close_connection();
array_pop($this->rows);

Running this code on localhost, does not give me any problems, I returned the values โ€‹โ€‹of the query. But when run from the server sends me the following error:

Fatal error: Call to a member function fetch_assoc() on a non-object in /home/code..on    line 36

I have read several publications, but I have not managed to solve this little problem. Thank you for your contributions.

Community
  • 1
  • 1
jorcast
  • 11
  • 3
  • 1
    $result is probably 'false', as the connection or the query failed. Rewrite your code by adding proper error handling... โ€“ CodeZombie Aug 19 '12 at 23:54
  • Probably, its been answered, http://stackoverflow.com/questions/5121027/fatal-error-call-to-a-member-function-fetch-assoc-on-a-non-object โ€“ FirmView Aug 19 '12 at 23:56

0 Answers0