'".$latmin."' AND rlat = '".$lonmin."' -6ren">
gpt4 book ai didi

mysql - SELECT 错误查询

转载 作者:太空宇宙 更新时间:2023-11-03 12:26:04 24 4
gpt4 key购买 nike

这一行可能有什么问题:

'$query = "SELECT * FROM messages WHERE (rlat => '".$latmin."' AND rlat <= '".$latmax."')      AND (rlon >= '".$lonmin."' AND rlon <= '".$lonmax."')";'

Error: Error in query: SELECT * FROM messages WHERE (r_lat => '55.4655951769' AND r_lat <= '55.496987423') AND (r_lon >= '25.5338700398' AND r_lon <= '25.5989507602'). 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 '=> '55.4655951769' AND r_lat <= '55.496987423') AND (r_lon >= '25.5338700398' AN' at line 1...

谢谢!

最佳答案

=> 不是已知的 operator .如果你想要 greater than or equal comparison operator ,那么你在 >= 之后。

顺便说一句,您可能会发现使用 BETWEEN ... AND ... 可以更简洁地编写您的查询运算符(operator):

SELECT *
FROM messages
WHERE rlat BETWEEN $latmin AND $latmax
AND rlon BETWEEN $lonmin AND $lonmax

您还应该研究通过 parameters to prepared statements 将变量传递到您的 SQL .

关于mysql - SELECT 错误查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17620876/

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