從我的SQL數據中刪除數據時遇到問題。我嘗試了各種版本的聲明,但無濟於事。以下是我提供的錯誤和我正在使用的聲明。從MySQL刪除時出現SQL錯誤
$sql = "DELETE FROM `saved_holidays` WHERE (subscriberID= $user AND title= $check_value)";
//connect to database then execute the SQL statement.
$db->exec($sql);
和錯誤消息是:
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 '@xml119.com AND title= Luxurious Jamaican holidays | 40% Discount On Accommodati' at line 1
我可以看到正確的數據被傳遞,但語法是錯誤的。誰能幫忙?
只是一個猜測,因爲我不太瞭解PHP。你需要在單引號中附加$ user和$ check_value嗎? – 2012-04-26 13:53:41