how come I can't get the ($result == '') near the end to answer back to the page if no information was found?
$initial_query = mssql_query("select * from agent_data where AGLCTY like '$city%' and AGLZIP like '$zip%'");
while ($row = mssql_fetch_row($initial_query)) {
$longitude = $row[13];
$latitude = $row[14];
}
// STEP 2 : CALCULATIONS
// $number_miles FROM FORM ENTRY
// ONE DEGREE OF LONGITUDE OR LATITUDE = 69.1 MILES
// SOURCE: http://www.geocrawler.com/archives/3/8/2001/6/0/6078232/
$conversion = 69.1;
$long_miles = $longitude $conversion;
$lat_miles = $latitude $conversion;
$long_sub = $long_miles - $number_miles;
$long_add = $long_miles + $number_miles;
$lat_sub = $lat_miles - $number_miles;
$lat_add = $lat_miles + $number_miles;
$long_sub_q = $long_sub / $conversion;
$long_add_q = $long_add / $conversion;
$lat_sub_q = $lat_sub / $conversion;
$lat_add_q = $lat_add / $conversion;
// STEP 3 : QUERY FOR LONGITUDE AND LATUTUDE RADIUS
mssql_connect('db','u','p') or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db(mapinfo) or DIE("Table unavailable");
$result = mssql_query("select * from agent_data where Longitude >= '".$long_sub_q."' and Longitude <= '".$long_add_q."' and Latitude >= '".$lat_sub_q."' and Latitude <= '".$lat_add_q."'");
// STEP 4 : POST RESULTS
echo "<table width=100% border=0 cellspacing=0 cellpadding=0 class=format_form>";
if($result){
while ($row = mssql_fetch_row($result)) { echo "stuff";
if ($num_agents >= $number_agents) {
break;
}
++$num_agents;
}
};
if ($result == '') {
echo "ERROR GOES HERE";
};
Thanks for any help!