ukweb Posted August 6, 2009 Share Posted August 6, 2009 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); Quote Link to comment Share on other sites More sharing options...
tivrfoa Posted August 6, 2009 Share Posted August 6, 2009 analyse the result of: echo $query_property_search; Quote Link to comment Share on other sites More sharing options...
ukweb Posted August 6, 2009 Author Share Posted August 6, 2009 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.