Well I have this query
$query = sprintf("SELECT price,
address,
state,
thumbnail,
name,
provider,
category,
latitude,
longitude,
( 6371 * acos( cos( radians('%s') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( latitude ) ) ) ) AS distance
FROM records
WHERE category IN ("1,2,3")
AND active = '1'
HAVING distance < '%s'
ORDER BY distance",
mysql_real_escape_string($center_lat),
mysql_real_escape_string($center_lng),
mysql_real_escape_string($center_lat),
mysql_real_escape_string($radius));
It basically grabs the coordinates from the table Deals and calculates the distance between those points and the user entered coordinates ($center_lat,lng). It then orders it based on distance.
Some records in the database don't have longitudes and latitudes and therefore won't be returned and the records that don't have coordinates have coordinates = '0' where as records that do have coordinates have coordinates = '1'.
My question is what if I want to also return records that don't have coordinates? how do I bypass the distance calculation process if the coordinates = '0'.