I have web form where a user can search certain fields and then have them displayed aggregated. For example, find all the routes I climbed with partner A in area(s) ALL (% - wildcard) between date1 and date2 -- so on. See below for the complete query.
I'm using pull down menu's and when a the user does not select something the default is ALL or <option value='%'> ALL </option> for all. Then all the other <options> are listed. Should I be using the % as a wildcard? I would like it to work if one, two, three... or all fields are selected. Obviously, the more options you select the more detailed your search becomes and vice versa. Any thoughts on what could be wrong with my query? Any help would be appreciated.
Thanks - Craig
Here is my query
query = "SELECT routes.*, users.email, users.fname, users.lname, users.user_id, ranking.* FROM routes, users, ranking WHERE email='$email' AND area LIKE '%$area%'
AND partner LIKE '%$partner%'
AND id BETWEEN '$rating1' AND '$rating2'
AND additional_rating IS NOT NULL LIKE '%$additional_rating%'
AND pitchs LIKE '%$pitchs%'
AND `type` LIKE '%$type%'
AND style LIKE '%$style%'
AND stars LIKE '%$stars%'
AND fall LIKE '%$fall%'
AND popular LIKE '%$popular%'
AND date_climbed BETWEEN '$date_climbed1' AND '$date_climbed2'
AND routes.rating = ranking.rating
AND routes.user_id = users.user_id
GROUP BY route_count ORDER BY area, date_climbed DESC";
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]