I have a web application that shows a list of events taken from a mysql db and presented to a user.
The user can then filter the results according to several (8-10) 'types'
My question is, how should I approach this? Basically what I need to do is take the user input for the filter (in $_GET
) and then find out which types he is looking to filter and according to that, change my sql query.
How do I do it in a way that is not very complex? I thought of using many 'if' or 'case' statements, but i'm not sure if that's the best solution as its a lot of coding for a very simple thing..
Can anyone give me some advice? Thanks,
Example DB:
EVENT_ID EVENT_NAME EVENT_TYPE
1 test regular
2 test2 vip
3 test4 testtype
...
Example $_GET:
$_GET['regular'] = 'on'
...