0
試圖運行此插入查詢錯誤我只是不明白,MYSQL PDO PHP
$query = $pdo->prepare("INSERT INTO `contacts` (`id`, `firstname`, `lastname`, `phonenumber`, `rank`, `time`) VALUES (NULL, :firstname, :lastname, :authcode, '1', NOW()");
$query->execute(array(":firstname" => $firstname, ":lastname" => $lastname, ":phone" => $phone));
$message[1] = '<font color=lime>Successfully added!</font>';
我得到這個錯誤:
Warning: PDOStatement::execute() [pdostatement.execute]: 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 1 in /public_html/contacts/add.php on line 61
這($query->execute(array...)
是線61
謝謝我在發佈後明白了,但再次感謝您的幫助。 – Swaly
你甚至沒有:電話在你的查詢中,你有:authcode而不是電話 – geryjuhasz
@geryjuhasz很好,所以在那個查詢中還有一個錯誤。 –