I have a little problem here. I am trying to add zip code radius search ability to my search page at the following URL: http://www.desirater.com/search.php
now, i am a newbie and dont know how to do that, so if new users signs up he/she has to enter a zip code if within USA, and users can search him/hjer within a specific radius of a specific zip code.
Any help will be appretiated.
---------------------
<?php
include("./admin/config.php");
include("$include_path/common.php");
include("$include_path/$table_file");
include("$include_path/doc_head.php");
include("$include_path/styles.php");
global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SESSION_VARS;
global $_SESSION;
if ($HTTP_POST_VARS!="")
$_POST=$HTTP_POST_VARS;
if ($HTTP_GET_VARS!="")
$_GET=$HTTP_GET_VARS;
if ($HTTP_SESSION_VARS!="")
$_SESSION=$HTTP_SESSION_VARS;
include ("Ads_new.php");
include("$include_path/left.php");
include("$include_path/right.php");
$results = "";
$member_search = " >> Member Search";
$tc_sql = "select count(*) as count from $tb_users where username REGEXP '$search_username' and age >= '$search_low_age' and age <= '$search_high_age' $gender_sql and state like '$search_state' and country like '$search_country' /*and star_sign like '$search_starsign' and ethnicity like '$search_ethinisity' and religion like '$search_religion'*/ and image_status = 'approved'";
$tc_query = mysql_query($tc_sql) or die(mysql_error());
switch ($sort) {
case "username_asc" : $order_by = "username"; break;
case "username_desc" : $order_by = "username desc"; break;
case "age_asc" : $order_by = "age"; break;
case "age_desc" : $order_by = "age desc"; break;
case "user_type_asc" : $order_by = "user_type"; break;
case "user_type_desc" : $order_by = "user_type desc"; break;
case "total_ratings_asc" : $order_by = "total_ratings"; break;
case "total_ratings_desc" : $order_by = "total_ratings desc"; break;
case "total_comments_asc" : $order_by = "total_comments"; break;
case "total_comments_desc" : $order_by = "total_comments desc"; break;
case "total_points_asc" : $order_by = "total_points"; break;
case "total_points_desc" : $order_by = "total_points desc"; break;
case "avg_rating_asc" : $order_by = "average_rating"; break;
case "avg_rating_desc" : $order_by = "average_rating desc"; break;
default : $order_by = "average_rating desc"; break;
}
$sql = "select $tb_users.id as id, $tb_users.username as username, $tb_users.realname as realname, $tb_users.country as country, $tb_users.age as age, $tb_users.user_type as user_type, $tb_users.total_ratings as total_ratings, $tb_users.total_points as total_points, $tb_users.average_rating as average_rating, $tb_users.total_comments as total_comments from $tb_users where username REGEXP '$search_username' and age >= '$search_low_age' and age <= '$search_high_age' $gender_sql and state like '$search_state' and country like '$search_country' /* and star_sign like '$search_starsign' and ethnicity like '$search_ethinisity' and religion like '$search_religion'*/ and image_status = 'approved' order by $order_by limit $csr, $search_users_per_page";
Bookmarks