Skip to content
Advertisement

Fatal error “compatible with PDO::query” in new PHP8

I have a Sql class that was working perfectly fine until PHP7. Now, using PHP8, I get the error shown below.

Fatal error: Declaration of DBSql::query($query, $parameters = []) must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed …$fetchModeArgs) in C:xampppageclassDBSql.php on line 15

Nothing has changed in the code!But I really can’t understand what’s wrong!

My Sql class has a “query” function like this (line 15)

JavaScript

The “$this->conection calls this:

JavaScript

Thanks to anyone who can help

Advertisement

Answer

Remove “query” and use “run” instead.

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