$name_keyword = $_REQUEST['name'];
$parent_categories = $_REQUEST['parent_categories'];
$sql_search_view = "SELECT\r\r\npostcode_location.id,\r\r\npostcode_location.main_cat_id,\r\r\npostcode_location.item_price,\r\r\npostcode_location.town,\r\r\npostcode_location.status,\r\r\npostcode_location.lat,\r\r\npostcode_location.lang,\r\r\npostcode_location.date,\r\r\nad_title_description.id,\r\r\nad_title_description.postcode_loaction_id,\r\r\nad_title_description.title,\r\r\nad_title_description.description,\r\r\nad_title_description.url\r\r\n\r\r\nFROM\r\r\npostcode_location\r\r\n\r\r\nInner Join ad_title_description ON postcode_location.id = ad_title_description.postcode_loaction_id\r\r\n\r\r\nWHERE  \r\r\npostcode_location.status ='1' ";
if (!empty($name_keyword)) {
    $bykeyword = " AND ad_title_description.title like '%" . $name_keyword . "%' ";
} else {
    $bykeyword = " ";
}
if (!empty($parent_categories)) {
    $ids = search_sub_cat($parent_categories);
    $by_category = " AND postcode_location.main_cat_id IN (" . $ids . ") ";
} else {
    $by_category = " ";
}
if (!empty($_POST['region'])) {
    $lat_lang = get_lan_lat($_POST['region']);
    $by_mils = " AND postcode_location.id IN(SELECT id FROM ( SELECT z.id, z.postcode, z.companyname, z.town, z.lat, z.lang, p.radius, p.distance_unit * DEGREES(ACOS(COS(RADIANS(p.latpoint)) * COS(RADIANS(z.lat)) * COS(RADIANS(p.longpoint - z.lang)) + SIN(RADIANS(p.latpoint)) * SIN(RADIANS(z.lat)))) AS distance FROM postcode_location AS z JOIN ( /* these are the query parameters */ SELECT " . $lat_lang['lat'] . " AS latpoint, " . $lat_lang['lng'] . " AS longpoint, " . $_POST['miles'] . " radius, 69.0 AS distance_unit ) AS p WHERE z.lat BETWEEN p.latpoint - (p.radius / p.distance_unit) AND p.latpoint + (p.radius / p.distance_unit) AND z.lang BETWEEN p.longpoint - (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))) AND p.longpoint + (p.radius / (p.distance_unit * COS(RADIANS(p.latpoint)))) ) AS d WHERE distance <= radius ORDER BY distance)";
} else {
    $by_mils = " ";
}
$cdate = date('Y-m-d');
$sql_search_view = $sql_search_view . $bykeyword . $by_category . $by_mils;
$result_search_view = mysql_query($sql_search_view);
$num_rows_views = mysql_num_rows($result_search_view);
$get_postcode = mysql_fetch_array($result_search_view);
$mappins = mysql_query($sql_search_view);
?>



Esempio n. 2
0
$rent_period = $_REQUEST['rent_period'];
$no_rooms = $_REQUEST['no_rooms'];
$acting_agent = $_REQUEST['acting_agent'];
$login_email_id = $_SESSION['login_email_id'];
$session_first_name = $_SESSION['first_name'];
$select_user_id = "SELECT id FROM registration WHERE email='" . $login_email_id . "'";
$run_user_id = mysql_query($select_user_id);
$fetch_user_id = mysql_fetch_array($run_user_id);
$user_id = $fetch_user_id['id'];
$main_cat = $_REQUEST['main_cat'];
$sub_cat_id = $_REQUEST['sub_cat_id'];
$sub_sub_cat = $_REQUEST['sub_sub_cat'];
$sub_cat_child_child = $_REQUEST['sub_cat_child_child'];
$sub_cat_child_child_child = $_REQUEST['sub_cat_child_child_child'];
$postcode = $_REQUEST['postcode'];
$lan_lot = get_lan_lat($postcode);
$companyname = $_REQUEST['companyname'];
/*$house_name=$_REQUEST['house_name'];

	$address1=$_REQUEST['address1'];

	$address2=$_REQUEST['address2'];

	$address3=$_REQUEST['address3'];*/
$town = $_REQUEST['town'];
/*$county=$_REQUEST['county'];

	$udprn=$_REQUEST['udprn'];*/
$mape = $_REQUEST['mape'];
$title = $_REQUEST['title'];
$description = mysql_real_escape_string($_REQUEST['description']);