这条线可能有什么问题:
'$query = "SELECT * FROM messages WHERE (rlat => '".$latmin."' AND rlat <= '".$latmax."') AND (rlon >= '".$lonmin."' AND rlon <= '".$lonmax."')";'
错误:查询错误:SELECT * FROM messages WHERE(r_lat =&gt; '55 .4655951769'AND r_lat&lt; = '55 .496987423')AND(r_lon&gt; = '25 .5338700398'AND r_lon&lt; = '25 .5989507602')。你有错误 你的SQL语法;查看与MySQL对应的手册 服务器版本,用于在'=&gt;附近使用正确的语法'55 0.4655951769' AND r_lat&lt; = '55 .496987423')AND(r_lon&gt; = '25 .5338700398'AN'在线 1 ...
谢谢!
答案 0 :(得分:3)
=>
不是已知的operator。如果你想要greater than or equal comparison operator,那么你就在>=
之后。
顺便说一句,您可能会发现您的查询可以使用BETWEEN ... AND ...
运算符更简洁地编写:
SELECT *
FROM messages
WHERE rlat BETWEEN $latmin AND $latmax
AND rlon BETWEEN $lonmin AND $lonmax
您还应该通过parameters to prepared statements调查将变量传递到SQL中。