Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
My Code:
<?php
$Sql="SELECT *, (3959 * acos(cos(radians(37)) * cos(radians(44)) * cos(radians(55) - radians(-122)) + sin(radians(37)) * sin(radians(44))) as distance FROM TableName HAVING distance < 25 ORDER BY distance LIMIT 0 , 20";
$result=mysql_query($Sql);
while ($row = mysql_fetch_array($result)){
echo $row['Id'];
}
Error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home...
Hi, I have longitude and latitude stored in the database and I want to calculate the KM - distance based on the user's current longitude and latitude with the shop's longitude and latitude stored in database. And I want a sorted result as well based on the distance. I googled and found some solutions but getting weird error.. Please check my code. I am not using variable in query. I just want to test if it runs. Please help