我試圖通過提交表格插入數據,這是我得到PHP:你在你的SQL語法錯誤檢查手冊
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 'desc,refno,quantity,imgname, image)
VALUES('name','Some desc ', '123','123' at line 1
以下的錯誤是我的SQL查詢
$query= mysqli_query($connect,
"INSERT INTO products(name,desc,refno,quantity)
VALUES('$names','$productdesc', '$refno','$quanitity')");
隨附的屏幕截圖,如果我叫print_r
這是我得到
Array
(
[name] => name
[refno] => 123
[quantity] => 123456
[description] => Some desc
[submit] => Add Product
)
DESC是一個保留字,使用反引號,\'遞減\' – Mihai
或者,更好的,不使用遞減 – Strawberry
感謝都是好樣兒的 – Sikander