Sunday 22 October 2017

php - Call to a member function

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".

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...