PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
SELECT venuename, address, city, `state`, zip, phone, areacode
FROM venues_new
WHERE venuename LIKE 'MMColParam%' AND areacode = 'varAC'
but what i want to do is allow the viewer to search with 1 or any combination of fields in the search form...to get results or narrow results, what this query is doing is making them choose both fields without having the option to choose just one...if they want a much broader search....and i have 4 more list/menu search fields to add on....
here is the form: http://www.nightspotz.com/search1.php
Last edited by olm75 on Sun Aug 14, 2005 2:54 am, edited 1 time in total.
$query_rsSearch = sprintf("SELECT venuename, address, city, `state`, zip, phone, areacode FROM venues_new WHERE venuename LIKE '%%s%' AND areacode = '%s'", $MMColParam_rsSearch,$varAC_rsSearch);
Notice the change in
...venuename LIKE '%%s%' AND area.....
Edit | Feyd's way is the correct way
Last edited by John Cartwright on Sun Aug 14, 2005 1:49 am, edited 1 time in total.
$query_rsSearch = sprintf("SELECT venuename, address, city, `state`, zip, phone, areacode FROM venues_new WHERE venuename LIKE '%%%s%%' AND areacode = '%s'", $MMColParam_rsSearch,$varAC_rsSearch);
excuse me .. I must get rid of this dastardly cold. ooo.
By the way, the backticks that I had in my SQL is just a little habit I picked up from analyzing PHPMyAdmin dumps to much. They enclose tablenames and the like, and are strictly optional, and I just add 'em in anyway for not much reason.
does any on have a full working example or tutorial of a search page that allows the viewer to search by 1 or any combination of fields....search must have at least 5 fields on it.....for some reason i cant do a query with more than combination of 2 fields....