[英]migrating a Pear DB site to mdb2, syntax error returned
我正在更新許多舊方法,但是我對這條線卡住了
$res =& $mdb2->query($mdb2->prepare("SELECT * FROM book WHERE id = ?"), array($sql_id));
我在錯誤日志中收到一條消息,提示PHP致命錯誤:調用未定義的方法MDB2_Error :: numRows()
所以我添加了這一行
if (PEAR::isError($res)) { die($res->getMessage().' ::: '.$res->getUserInfo()); }
看看導致錯誤的原因,然后我將其返回屏幕
MDB2 Error: syntax error ::: _doQuery: [Error message: Could not execute statement] [Last executed query: MDB2 Error: syntax error] [Native code: 1064] [Native message: 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 'MDB2 Error: syntax error' at line 1]
我不確定查詢出了什么問題,對我來說看起來還好嗎?
在這里,無需執行PREPARE部分。
$res =& $mdb2->query("SELECT * FROM book WHERE id = '" . $sql_id . "' " );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.