Building WHERE clause based on checkboxes
Let's say I have a form that has 30 checkboxes that correspond to music genres (it submits to a PHP form handler).
I have an artists table that has a genre field. What are the best practices on building a query that would behave along the lines of
Select name FROM artists WHERE genreId = 1 OR genreId = 2 OR . . . etc etc.
I know I can dynamically build my WHERE string in PHP, but I'm in the habit of using prepared statements and stored procedures. What should I do?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread