Page 1 of 1

problem with selecting data from a set

Posted: Sun Oct 31, 2004 2:34 pm
by briwal222
Restaurant Search engine:
table 1 is tblAmenityType.
table 2 is tblRestaurantFeatures

Table 1 has 2 fields, amenityID and amenityName.
Table 2 has several fields, one of which is also restID, and the other is restFeatures, which is a set.('1','2','3','4','5'..) I am trying to determine if this is the proper way to use this in my query.
What I am trying to do is create an advanced search, where users can modify their restaurant search based on different features, such as Live Entertainment, Valet Parking, etc. I can't determin how to create a query that will find restaurants that have one of the numbers from the set. If this is confusing, I am trying to determine the query allowing me to modify the search by these features, which I have stored in the "restFeatures" set as 1,2,3 or 1,2 or 3,4 etc. which will correspond to the proper amenityID.
Any help would be greatly appreciated.

Split.

Posted: Thu Nov 04, 2004 7:57 am
by AnarKy
Hi,

I might not understand your problem too well,
but if I do then this might be one way,
though it may not be the best, to get a dirty search going.

Code: Select all

$ArrayName = split("," , $restFeatures);
now you can search through the Array for individual pieces of the
set to see if it has a property that u desire.

This is done in php. I’m not sure how this would be done via a SQL query.
Sorry,
Hope you solve this soon, and when u do, let me know :)

Posted: Thu Nov 04, 2004 9:23 am
by timvw
might want to have a restaurantfeature table with (restaurant_ID, feature_ID)


because, now you have to do a painfull/slow

Code: Select all

SELECT * FROM foo WHERE features LIKE '%$feature%'

Posted: Thu Nov 04, 2004 9:59 am
by briwal222
I do have a table that has those fields. I think I am going to skip the set portion. Next step is to figure out how to incorporate the check boxes into the query for the modification of the search. In other words, someone searches by a specific cuisine. Underneath this drop down list where they choose cuisine would be a series of check boxes that would modify the search by amenities. I have not really worked with this type of search and am desperately looking for someone to help me figure this out.