我一直收到这个错误,但我不知道为什么......
错误是:
Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]:
General error' in test.php:25\nStack trace:\n#0 test.php(25):
PDOStatement->fetch()\n#1 {main}\n thrown in test.php on line 25
我的查询是这样的:
$stmt = $pdo->prepare("
SELECT *,t1.id AS theID FROM users
t1 LEFT JOIN users_settings t2
ON t1.id=t2.tid
INNER JOIN extra_settings t3
ON t2.bid=t3.id");
try {
$stmt->execute();
} catch (PDOException $e) {
echo $e -> getMessage();
}
while($row = $stmt->fetch()){ //error is here
//do stuff
}
该脚本有效,但仍然显示错误=/
错误是什么意思,我该如何解决?