Jump to content

Fatal error: Call to a member function fetchAll() on a non-object


Mufleeh

Recommended Posts

Hi,

 

I am receiving the below when I'm trying to log into my system....

 

Fatal error: Call to a member function fetchAll() on a non-object in C:\Program Files\BitNami WAPPStack\apache2\htdocs\census\.private\permission.php on line 87

 

Below are the codes in the line number 86 and 87,

 

$result = $dbh->query($query);

$rows = $result->fetchAll();

 

Is there any error in this code or suggestions to fix this?

 

 

Regards,

Mufleeh

That error message indicates that (in your case) $result does NOT contain an object. Since $result is set (presumably to a result object) in the previous statement, this would indicate that $dbh->query($query); failed. This would indicate that either the query failed -- you need to check the value of $query; or there is no database connection -- you need to check the code that assigns $dbh. You may also need to check the base class used to create $dbh (if it is a home-grown class).

Hi,

 

I think it is being connected to the data base, because the welcome message appears with the user log in name. Next the $dbh is assigned as,

 

$dbh = new PdoExt();

 

Actually the system was working perfectly before I upload few data for the database. Please check whether you can help me.

 

 

Regards,

Mufleeh

I have provided all the help I can based on the code posted.

 

This would indicate that either the query failed -- you need to check the value of $query; ...

 

Did you check the $query? Is it valid? Did you run it directly? Did it work?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.