gpt4 book ai didi

php - 是什么导致此 mysql 查询错误?

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

mysql_query ("
INSERT INTO items
(index, name, description, given_by,
cost_to_tcs, starting_bid, auction_type)
VALUES
('{$index_number}','{$name}','{$description}','{$donated_by}',
NULL,'{$auction_type}','{$starting_bid}')
")
or die("3: " . mysql_error());

错误:

3: 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 ''index', 'name', 'description', 'given_by', 'cost_to_tcs', 'starting_bid', 'auct' at line 1

感谢您的帮助。

最佳答案

index 为mysql保留关键字,将index用(反引号)`` ` 包起来

INSERT INTO items 
(`index`, `name`, `description`, `given_by`,
`cost_to_tcs`, `starting_bid`, `auction_type`)

Reserve key words

关于php - 是什么导致此 mysql 查询错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8708224/

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