0

Hi,all
Here is the sql sentence i wrote on my php file.
But when i test with it nothing show up which there should have some results??
My idea is :get the sw and ne point, choose every value live inside the rectangle in my database

//zips is my table in the phpmyadmin
//$swlat and $swlng are both float format, same format in //$nelat,$nelng
$sql = "SELECT ZipCode FROM zips 
            WHERE Latitude BETWEEN '$swlat' AND '$nelat'
            AND  Longtitude BETWEEN '$nelng' AND '$swlng'
            ORDER BY Population DESC LIMIT 5";

Many Thanks

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by ShawnCplus
0

If it returns 0 rows but there isn't an error than its just that. Nothing matches the conditions you're giving it. Trying making your condition less specific until you get a result and then narrowing it down again. Ie.,

SELECT ZipCode FROM zips ORDER BY Population DESC LIMIT 5

Then

SELECT ZipCode FROM zips 
  WHERE Latitude BETWEEN '$swlat' AND '$nelat'
  ORDER BY Population DESC LIMIT 5

etc.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.