PDOException’ with message ‘SQLSTATE[HY000]: General error’
今天用自己封装的pdo类update一条记录时候报错
stackoverflow上回答原文
This is what happens:
You are trying to fetch an UPDATE query. You can’t do that because UPDATE queries does not return values. If you wish to know how many rows were affected by the query, use the rowCount() function instead. Notice that not all DB Drivers provide the affected rows.
You are using undeclared variables (at least in the code you posted here). This isn’t the reason for this particular error, but could generate others.
You’re not using the data you have selected from the database
Also, it is recommended to make all PDO operations within the try block, otherwise you may get unhandled exceptions.
代码
调用代码如下
$d