Jump to content

Recommended Posts

Hi all,



require 'db/connect.php';
$result = $db->query("SELECT * FROM people");
I obtained a blank page running the above script, which indicates that everything is fine (path and table name are correct). I then removed the * from the query to see if it would report an error, but it did not. I added print_r($result); and run it. Nothing has changed. I included the * and run, it reported the number of rows and columns in the table.
Why there has a been a lack of error reporting in this instance, noting that the ini file is configured to report all sorts of errors, even the warnings and notices (and it is reporting all that in other scripts)?
Link to post
Share on other sites

What type of object is $db?


PDO won't throw errors unless you specifically tell it to. $db->query() will just return false if the query is wrong.


If you're using PDO, be sure to set the error mode http://php.net/manual/en/pdo.setattribute.php

Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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