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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.