0
如何在PHP/MySQL中修復此行?服務器返回錯誤嘗試插入幾個值時出現PHP/MySQL語法錯誤
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', 'title', 'yes', 'no') VALUES (2,test, 0, 0)' at line 1
爲線
mysql_query("INSERT INTO things('id', 'title', 'yes', 'no') VALUES ($counter,$thing, 0, 0);", $con);
謝謝,這似乎是解決這個問題的報價。但是現在它說''字段列表'中的未知列'testtest',其中testtest是$ thing。 –
沒錯,因爲你不會引用你的字符串。 ($ counter,'$ thing',0,0)在技術上可行,但你應該通過內置的mysqli或者PDO函數來做適當的消毒處理。任何兩個教程將告訴你如何做到這一點 –
我會研究它。謝謝! –