gpt4 book ai didi

mysql - 我的 mysql 查询出错了,尽管看起来完全没问题

转载 作者:行者123 更新时间:2023-11-30 01:37:22 26 4
gpt4 key购买 nike

我有这个查询

 mysql_query("INSERT into reviews VALUES(0,$pid,$id,'new')") 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 ''new')' at line 1"

虽然看起来完全没问题,但数据库表结构是:

 `id` int(11) NOT NULL AUTO_INCREMENT,
`proposalid` int(11) NOT NULL,
`reviewerid` int(11) NOT NULL,
`status` enum('approved','declined','noresponse','new') NOT NULL DEFAULT 'new',
PRIMARY KEY (`id`);

看起来没有什么问题,但是为什么会出错呢?

最佳答案

由于您的 ENUM status 默认值设置为“new”,您可以尝试 INSERT,例如:

mysql_query("INSERT into reviews (`proposalid`, `reviewrid`) VALUES($pid, $id);") or die(mysql_error());

也许此后错误会更多。

关于mysql - 我的 mysql 查询出错了,尽管看起来完全没问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16682811/

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