警告:PDOStatement :: execute():SQLSTATE [42000]:语法错误或访问冲突:1064您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便在#SET; SET user_surname =' name',SET user_sprat =' 1234567''''在第3行我
//the query to run
$sql = "UPDATE user
SET user_firstname = ?,
SET user_surname = ?,
SET user_sprat = ?,
SET user_country = ?,
SET user_telephone = ?,
SET user_mobile = ?,
SET user_contactemail = ?,
SET user_introduction = ?
WHERE user_id = ?
AND user_enabled=1";
//run the query
$database = DatabaseFactory::getFactory()->getConnection();
$update_profile = $database->prepare($sql);
$update_profile->execute(array($firstname, $surname, $sprata, $country, $telephone, $mobile, $email, $introduction,Session::get('id')));
我收到了这个错误,我不确定为什么,根据我的知识,我的所有表格的任何帮助都会很棒
答案 0 :(得分:4)
更新查询的正确SQL语法为UPDATE table SET rowA = value, rowB = value
注意SET
提及一次,逗号用于分隔行。
EG:
$sql = "UPDATE user SET
user_firstname = ?,
user_surname = ?,
user_sprat = ?,
user_country = ?,
user_telephone = ?,
user_mobile = ?,
user_contactemail = ?,
user_introduction = ?
WHERE user_id = ?
AND user_enabled=1";
参考: