更新时间:2023-02-10 15:59:49
使用MySQl的BETWEEN
和从不使用引号来比较数字.因此查询变为:
Use the MySQl's BETWEEN
and NEVER use quotes for comparing numbers. So the query becomes:
$sql = "SELECT *
FROM shops
WHERE shop_id = $shopID
AND lat BETWEEN $lat_min AND $lat_max
AND lng BETWEEN $long_min AND $long_max";
在这里,我认为shop_id
列是自动递增的数字.
Where, I have considered that shop_id
column is auto-incremental number.