Skip to content
Advertisement

Uncaught Error: Call to a member function fetchAll() on boolean

index.php:

JavaScript

and get the error :

JavaScript

Db.php

JavaScript

If I running in the sql() method, execute() and fetch() the data inside it , it can truly get the data , but put the execute() and fetch() to the query() method, getting the error message, Any Idea? ;

Advertisement

Answer

There is an error in your code. In this line:

JavaScript

The execute() method is PDOStatement::execute. This is the signature:

JavaScript

Which means it returns boolean. Your mistake is you are trying to call fetchAll() on a boolean.

For more information about the error message, see this page.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement