Forums
This topic is locked
Any or All Search Results
09 Oct 2008 20:13:31 steve h posted:
HiI work in branch of the travel industry. I have made a PHP MySQL database and using Dreamweaver have prepared the search page that includes 3 dynamic dropdown menus. The first is Property Type, the second Location and the third is Bodies. There is a recordset for each menu :
Recordset (RSlocation)
Recordset (RSproperty)
Recordset (RSbodies)
and the corresponding Dynamic List/Menus:
Dynamic List/Menu (list_location)
Dynamic List/Menu (list_property)
Dynamic List/Menu (list_bodies)
I have filtered the SQL to return distinct values so that they look like this
SELECT DISTINCT apartments_test_xps.Location
FROM apartments_test_xps
SELECT DISTINCT apartments_test_xps.property
FROM apartments_test_xps
SELECT DISTINCT apartments_test_xps.Bodies
FROM apartments_test_xps
So far so good. The SQL for the results page look like this:
SELECT *
FROM apartments_test_xps
WHERE apartments_test_xps.Location = list_location AND apartments_test_xps.property = list_property AND apartments_test_xps.bodies >= list_bodies
with these variables
list_location
Name:list_location
Type:Text
Default Value: Balcon de Los Gigantes
Run_time Value: $_GET['list_location']
list_property
Name:list_property
Type:Text
Default Value: Apartment
Run_time Value: $_GET['list_property]
list_bodies
Name:list_bodies
Type:Numeric
Default Value: 4
Run_time Value: $_GET['list_bodies']
Using the above procedures produces just the results I am looking for with one exception. I cannot figure out how to filter the Location menu to also include an ANY or ALL location variable without messing up the results. I tried to insert a static value using the name ANY with the wildcard * value, but this returns no results at all.
I suspect the SQL on the results page needs further tweeking but I have to admit that I am really struggling with this.
Any help would be great.
Thank you
Steve