Alex Rivera | Logout

How to get a query error from prepare() in PDO PHP?

Asked 2012-01-08T08:41:15.870
82
    $st = $db->prepare("SELECT * FROM c6ode");

How can I check the intentional mysql error for the query in above case?

Edit
Report

1 Answer

56

I'm using this without any additional settings:

if (!$st->execute()) {
    print_r($st->errorInfo());
}
answered 2012-01-08T08:48:55.120

Your Answer