gpt4 book ai didi

php - mysql中的1064语法错误

转载 作者:行者123 更新时间:2023-11-29 05:23:29 25 4
gpt4 key购买 nike

我很困惑。我不知道错误是什么。执行时我收到一条消息:

" 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 'group(creator,type,name,details,icon)values (6,'information sharing','test','j' at line 1"

我的查询是:

INSERT INTO group 
(creator, type, name, details, icon) VALUES
(6, 'information sharing', 'test', 'just for testing',
'My friend/group_uploads/pic00_6_0d46839f6371fb84f6b6c682f5fc2c77.jpeg')

这是我的表格规范:

type      varchar(1000)
name varchar(1000)
details varchar(1000)
creator bigint(20)
icon varchar(1000)

请帮我改正错误。

最佳答案

group 是一个 reserved word在 MySQL 中。您需要用反引号将其括起来。

像这样..

insert into `group`(creator, type, name, details, icon) values ('6','information sharing','test','just for testing','My friend/group_uploads/pic00_6_0d46839f6371fb84f6b6c682f5fc2c77.jpeg')
^ ^

尽量避免为您的列和表使用此类名称。

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

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