[英](PHP) (SQL) What is wrong with the syntax of INSERT INTO?
[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 ')' at line 1] in EXECUTE("INSERT INTO mailer_recipients (status,send_result_id) VALUES (,)")
public function saveData($status, $resultId)
{
global $dbwriter;
// Update send result, send result ID, status
$sql = 'UPDATE ' . $this->recipientDbTable . ' SET ' . $this->recipientDbColumn['status'] . "='$status' WHERE " . $this->recipientDbColumn['id'] . '=' . $this->getId();
$sql = 'UPDATE ' . $this->recipientDbTable . ' SET ' . $this->recipientDbColumn['result_id'] . "='$resultId' WHERE " . $this->recipientDbColumn['id'] . '=' . $this->getId();
$sql = 'INSERT INTO ' . $this->recipientDbTable;
$sql .= ' (' . $this->recipientDbColumn['status'] . ',' . $this->recipientDbColumn['result_id'] . ')';
$sql .= ' VALUES ' . '(' . $status . ',' . $resultId . ')';
$result = $dbwriter->execute($sql);
}
UPDATE 沒問題。 說不清是什么問題。
閱讀您的錯誤消息。 您的 SQL 以VALUES (,)
結尾,這是無效的語法。 顯然, $status
和$resultId
是空的( ''
、 null
或其他評估為空字符串的值)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.