0

Please, how do I resolve the following error?

Fatal error: Call to a member function fetch_assoc() on a non-object in......

database.php

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

usuario.php

public function getUsers(){
//$this->query variable define in class abstract database 
$this->query = " SELECT * FROM Usuario LIMIT 0, 30";
$this->get_results_from_query();
}

Everything is working perfect, but calling function getUsers results in "fatal error".

halfer
  • 19,824
  • 17
  • 99
  • 186
felixmpa
  • 2,028
  • 1
  • 15
  • 16
  • 1
    Add some debugging - your query is probably failing, but your code assumes that everything is fine. Check the return value from the `query()` call, and if it's false, echo out the error message from the database. – andrewsi Oct 13 '13 at 05:15
  • Just delete the question or flag it for closure. – Wesley Murch Oct 13 '13 at 05:28

0 Answers0