Avatar of BrighteyesDesign
BrighteyesDesign
Flag 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?
MySQL ServerPHP

Avatar of undefined
Last Comment
John Kawakami

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Beverley Portlock

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
John Kawakami

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck