I read this tutorial about PDO. I had an error and tried the errorInfo() function. However, I get this error when trying to use errorInfo():
Fatal error: Call to a member function errorInfo() on a non-object in C:\Users\Nico\Dropbox\PHP\Vagex Clone\Website\pdo\select.php on line 8
I used this code as it's in the tutorial:
$query = $db->query('SELECT * FROM notexistingtable'); //that was the error I had
if (!$query) {
var_dump($query->errorInfo());
}
So - if I have an error like this, how do I correctly use the errorInfo() function?