当您的查询不正确时,php 会返回如下错误消息:
Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@aaa.com)' at line 1' in C:\Program Files\...
有没有办法强制它在错误消息中显示完整的 MySQL 查询字符串?
更新:
我需要一个适用于整个网站(在开发阶段)的解决方案。
也许通过 my.ini 的 php.ini
我目前使用 ZF 进行数据库交互。
最佳答案
$stmt = /* PDOStatement */
if (!$stmt->execute()) {
echo $stmt->queryString;
}
关于php - 强制 PHP 显示完整的 MySQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10160540/