這是我的插入查詢。無法在PHP中使用MySql插入數據
$insertQuery = "INSERT INTO timeline (id_str, from_user, text, timestamp, location) VALUES ($resultsAry[$x]['id_str'], $resultsAry[$x]['from_user'], $resultsAry[$x]['text'], $datetime, $locationAry[$i]['place'])";
傳遞給查詢的值似乎是正確的(通過回顯所有值進行檢查)。但我得到了以下錯誤。
Insert failed: 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 '['id_str'], Array['from_user'], Array['text'], 2011-05-23 18:58:27, Array['place' at line 1
請幫忙?
我認爲您需要引用您的值。 – martynthewolf 2011-05-23 11:07:13