How to make a filtered search with mysql?
Posted: Sun Aug 05, 2007 2:18 am
Hi,
I came up with the challenge of making a search form, such that users can select how they want to search:
By Model # (only numbers)
Just one keyword (ex: cellphone = will only return results containing the keyword cellphone)
Multiple keywords (ex: cell phone = will return results containing both the words cell and phone)
Then make these 3 search options as check boxes. I know how to code the sql queries, but I dont know how to code the php so that it selects which proper query based on which checkbox has been selected.
Maybe someone has an example for this, or can describe what method to use. Thanks in advance!
I came up with the challenge of making a search form, such that users can select how they want to search:
By Model # (only numbers)
Just one keyword (ex: cellphone = will only return results containing the keyword cellphone)
Multiple keywords (ex: cell phone = will return results containing both the words cell and phone)
Then make these 3 search options as check boxes. I know how to code the sql queries, but I dont know how to code the php so that it selects which proper query based on which checkbox has been selected.
Maybe someone has an example for this, or can describe what method to use. Thanks in advance!