我尝试在php中用PDO做一个准备好的SELECT语句。这是我的发言:
# named placeholders
$STH = $DBH->("SELECT * FROM `highscore_ranked` WHERE DeviceID = :deviceid ORDER BY Points DESC LIMIT 0 , 10");
$STH->bindValue(':deviceid', $DeviceIDClear);
# setting the fetch mode
$STH->setFetchMode(PDO::FETCH_ASSOC);
$STH->execute();
但是我得到了错误:
PHP Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$'
在这一行:
$STH = $DBH->("SELECT * FROM `highscore_ranked` WHERE DeviceID = :deviceid ORDER BY Points DESC LIMIT 0 , 10");
我不知道这条线路有什么问题。
答案 0 :(得分:3)
你忘了方法的名字!!!!
$STH = $DBH->prepare("SELECT * FROM `highscore_ranked` WHERE DeviceID = :deviceid ORDER BY Points DESC LIMIT 0 , 10");