Jump to content

[SOLVED] This isnt working and I dont know why!!!!


ukweb

Recommended Posts

:facewall:

Hi all

 

I honestly cannot see what is wrong with this code but it returns no results. Basically bedrooms are stored in a separate database as an 'open_asset', the database was designed this way so that the 'property_list' table could store commercial and domestic properties in it.

 

here's the code, any help I would really really be thankful for!

Ta! Ste x

 

		if (!($d_location == 'all')) {
		$location_sql = 'AND property_list.town = \''.$d_location.'\' ';

	} else {
		$location_sql = '';

	}
	if (!($d_type == 'all')) {
		$type_sql = 'AND property_list.property_type = \''.$d_type.'\' ';

	} else {
		$type_sql = '';

	}

	// The Query
	mysql_select_db($database_sql, $sql);
	$query_property_search = sprintf("SELECT property_list.*, open_assets.value AS bedrooms FROM property_list, open_assets 
									 WHERE (property_list.property_id = open_assets.parent_id) AND open_assets.title = 'Bedrooms' 
									 AND property_list.site_id = %s AND property_list.sale_type = 'rental' 
									 ".$type_sql."AND property_list.value >= %s AND property_list.value <= %s 
									 ".$location_sql."AND open_assets.value >= %s AND open_assets.value <= %s",
		GetSQLValueString($site_id, "int"),
		GetSQLValueString($d_type, "text"),
		GetSQLValueString($d_price_min, "int"),
		GetSQLValueString($d_price_max, "int"),
		GetSQLValueString($beds_min, "int"),
		GetSQLValueString($beds_max, "int"));

	$property_search = mysql_query($query_property_search, $sql) or die(mysql_error());
	$row_property_search = mysql_fetch_assoc($property_search);
	$totalRows_property_search = mysql_num_rows($property_search);

analyse the result of: echo $query_property_search;

 

You were right to tell me to do that. I had a hour away from it cos it was rly winding me up!! Spotted the problem, i had 'rental' instead of 'sale', and also one to many GetSQLValueString functions too! All is well and its working thanks! Good night all!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.