Answer the question
In order to leave comments, you need to log in
How to get detailed information about a PDO error?
Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]:
Invalid parameter number: parameter was not defined' in (line 118) Stack trace: #0
PDOStatement->execute() #1 {main} thrown in
Line 118 is $b->execute();
in General it is clear that he says that the wrong number of parameters and some is not defined, but somehow you can make him show which one?
Tried to put:
echo $pdo->errorCode();
print_r($pdo->errorInfo());
Answer the question
In order to leave comments, you need to log in
Catch the PDOException, it contains more detailed info by mistake. Plus, in the catch block, you can process the PDOStatement request object, from which you can extract data using the debugDumpParams() method. For example:
try {
$stmt->execute($sq);
} catch (PDOException $e) {
print_r($e->getMessage());
$stmt->debugDumpParams();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question