gpt4 book ai didi

php - mysql "insert into"SQL语法错误问题

转载 作者:行者123 更新时间:2023-11-29 03:58:19 24 4
gpt4 key购买 nike

这是PHP代码:

$stringquery = "INSERT INTO sikurim(name, title, desc, category, subcategory)

VALUES ('$contact', '$heading','$comments', '$catF', '$catS' ) ";

mysql_query($stringquery) or die(mysql_error());

我得到了错误:

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, category, subcategory) VALUES ('jhjh', ' fffff','fffff', '2', '4' )' at line 1

我找不到代码有什么问题,有人可以帮忙吗?

最佳答案

DESCreserved MySQL keyword .您需要将其括在反引号中:

$stringquery = "INSERT INTO sikurim(name, title, `desc`, category, subcategory) VALUES ('$contact', '$heading','$comments', '$catF', '$catS' )";

关于php - mysql "insert into"SQL语法错误问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7166813/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com