我试图通过提交表格插入数据,这是我得到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