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);

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.