$sql = "UPDATE result_table SET distance ='{$distance}', city = '{$city}', hoody_sort = '{$hoody_sort}' WHERE listing_id='{$listing_id}'"; $update_result = mysql_query($sql) or die(fatal_error(203, $user, $user, $today, $sql, mysql_error())); // if the user lives seller's range, take the listing off the table } else { if ($service_row['listing_location'] == 1) { $sql = "SELECT lng,lat FROM User_Address WHERE fb_uid='{$fb_uid}'"; $range_result = mysql_query($sql) or die(fatal_error(205, $user, $user, $today, $sql, mysql_error())); $range_row = mysql_fetch_array($range_result, MYSQL_ASSOC); $range = (int) distance($user_lat, $user_lng, $range_row['lat'], $range_row['lng']); // if the user lives outside of seller's range if ($range > $service_row['listing_range']) { $sql = "DELETE FROM result_table WHERE listing_id='{$listing_id}'"; $update_result = mysql_query($sql) or die(fatal_error(206, $user, $user, $today, $sql, mysql_error())); } else { // hoody_sort $hoody_sort = hoody_sort($user, $fb_uid, $distance, $popularity); // service location $city = $service_row['city']; $sql = "UPDATE result_table SET distance ='-1', city = '{$city}', hoody_sort = '{$hoody_sort}' WHERE listing_id='{$listing_id}'"; $update_result = mysql_query($sql) or die(fatal_error(207, $user, $user, $today, $sql, mysql_error())); } } } } } // end of while($w=mysql_fetch_array($r)) } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
// if the user lives outside of seller's range if ($range > $service_row['listing_range']) { $sql = "DELETE FROM result_table WHERE listing_id='{$listing_id}'"; $update_result = mysql_query($sql) or die(fatal_error(206, $user, $user, $today, $sql, mysql_error())); } else { // hoody_sort $hoody_sort = hoody_sort($user, $fb_uid, $distance, $popularity); // service location $city = $service_row['city']; $sql = "UPDATE result_table SET distance ='-1', city = 'home', hoody_sort = '{$hoody_sort}' WHERE listing_id='{$listing_id}'"; $update_result = mysql_query($sql) or die(fatal_error(207, $user, $user, $today, $sql, mysql_error())); } } else { if ($service_row['listing_location'] == 3) { // hoody_sort $hoody_sort = hoody_sort($user, $fb_uid, -1, $popularity); // service location $city = $service_row['city']; $sql = "UPDATE result_table SET distance ='-2', city = 'virtual', hoody_sort = '{$hoody_sort}' WHERE listing_id='{$listing_id}'"; $update_result = mysql_query($sql) or die(fatal_error(207, $user, $user, $today, $sql, mysql_error())); } } } } } // end of while($w=mysql_fetch_array($r)) } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">