Link to home
Create AccountLog in
Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan

asked on

How to mix to search queries to show results on the same page

I have a page on a property page with two search functions. I want both searches to display results on the same page.

Search1 searches for a country Search2 search for county, city, bedrooms, min and max.


Search 2 works fine using:

$country_code = $_GET["intsearch"];
$bedrooms = $_GET["bedrooms"];
$min = $_GET["min"];
$max = $_GET["max"];
$cityCode = $_GET["city"];


mysql_select_db($database_Raglan, $Raglan);
$query_featured = sprintf("SELECT propertyID, bathrooms, bedrooms, mainimage, name, prices, pricePrefix, propertyType, regionCode, `currency`, country_code, cityCode FROM properties WHERE country_code = '$country_code'  AND cityCode = '$cityCode' AND bedrooms='$bedrooms' AND prices BETWEEN '$min' AND '$max' ORDER BY prices ASC", GetSQLValueString($colname_featured, "text"));

Open in new window


But search1 one does not work because it's only sending a country_code variable and because my query is looking for bedrooms and price nothing shows.

How can I have this so when a search is submitted with Search1 one all properties in the selected country display regardless of bedrooms and price?

I can send over bedrooms, city_code, min, max in the URL with a value of '0'  but i'm not sure how I would make it so '0' means show all results.


Hope this makes sense?
ASKER CERTIFIED SOLUTION
Avatar of Beverley Portlock
Beverley Portlock
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account