當我嘗試執行下面的代碼時,顯示錯誤:
無效的查詢:您的SQL語法有錯誤;檢查對應於你的MySQL服務器版本正確的語法使用手動近「」,「」,「」,「」)」在1號線
Mysql無法更新數據
$result = mysql_query("REPLACE INTO templates (id,title,subtitle,background,image,image2,image3,image4,image5,image6,createdby) VALUES ('$id','$title','$subtitle','$background','$image','$image2','$image3','$image4,'$image5','$image6','$fbuid')");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
但下面的代碼工作完全精細:
mysql_query("REPLACE INTO Users (fbuid,username,email,token) VALUES ('$fbuid', '$name', '$email', '$token')");
什麼可以是問題?
可以參考前面的帖子更新數據 http://stackoverflow.com/questions/10177208/update-a-column-value-replacing-part-of-a-string 希望這有助於你。 –
我已經問過自己很多次了,也許你可以在下面發表評論。你爲什麼使用'mysql _ *()'函數? – Xorifelse
如果'$ id'是您的主鍵,您不需要插入它,您可以將其保留爲這樣一個空白:mysql_query(「REPLACE INTO templates(id,title,subtitle,background,image,image2,image3,image4,image5 ,image6,createdby)VALUES('','$ title','$ subtitle','$ background','$ image','$ image2','$ image3','$ image4','$ image5',' $ image6','$ fbuid')「);' – EaBangalore