-1

谁能帮我弄清楚为什么以下代码会返回 MySQL 语法错误?

$stmt = $pdo->prepare('INSERT INTO `message`(`id`, `message`, 
        `scramble_level`, `scramble_key`) 
        VALUES (:id, :message, :scramble_level, :scramble_key');


$stmt->execute(array(':id' => 'NOW()', ':message' => $theMessage, 
        ':scramble_level' => $scrambleLevel, 
        ':scramble_key' => $scrambleKey));

这导致:

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 '' at line 3
4

1 回答 1

5

你错过了你的右)括号VALUES()

VALUES (:id, :message, :scramble_level, :scramble_key)');
于 2013-04-14T22:24:06.100 回答