gpt4 book ai didi

php - Mysql查询奇怪失败

转载 作者:行者123 更新时间:2023-12-01 00:04:55 24 4
gpt4 key购买 nike

当我添加 key 列时,这个查询给我一个错误,有什么帮助吗?

usernameproduct 是复合主键,以防万一。

mysql> select * from sw_product_session where username='admin';
+----------+----------+------------+----------------------------+
| username | product | expire | key |
+----------+----------+------------+----------------------------+
| admin | printbox | 1373550885 | 2ijm77cpnfc7miktasopkik2q2 |
+----------+----------+------------+----------------------------+
1 row in set (0.00 sec)

mysql> select * from sw_product_session where username='admin' AND product='printbox';
+----------+----------+------------+----------------------------+
| username | product | expire | key |
+----------+----------+------------+----------------------------+
| admin | printbox | 1373550885 | 2ijm77cpnfc7miktasopkik2q2 |
+----------+----------+------------+----------------------------+
1 row in set (0.00 sec)

mysql> select * from sw_product_session where username='admin' AND product='printbox' AND key='2ijm77cpnfc7miktasopkik2q2';
ERROR 1064 (42000): 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 'key='2ijm77cpnfc7miktasopkik2q2'' at line 1

最佳答案

你需要记住任何reserved words需要转义:

AND `key`='...'

关于php - Mysql查询奇怪失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17595436/

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