troubleshooting Question

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

Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan asked on
PHPMySQL Server
2 Comments2 Solutions441 ViewsLast Modified:
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"));

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
Beverley Portlock

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros