Greetings to all PHP guru
i have a database called customer which one of the field is zipcode
and i have also function that determine the distance between zipcodes (in miles )
- the computation is determine the zipcode entered by the user and the zipcode in the user table
see : http://www.cryptnet.net/fsp/zipdy/
there is no problem in computing the distance
but new problem here is how can i sort the data via distance? since the distance is not part of the field in the table user
this is the simple code (assuming sql statement has no error)
$origzip = $_GET["zip"];
$sql =mysql_query('select latittude,longtitude from zipcode where zip='$origzip');
$lat1= $latitude
$lon1 = $longtitude
while ($sqlsearch)
{
$sqlfield = $userzipcode;
$s=mysql_query("select latittud, longtitude from zipcode where zip='$sqlfield'");
$lat2 = $s->latitude;
$lon2 = $s0>longtitude
echo calculate_mileage($lat1, $lat2, $lon1, $lon2) //this is the distance output in miles
}
im already run out of ideas on how to make the sql works using sort in the miles
thanks in advance