MySQL WHERE IN (*) - possible?
Posted: Thu Mar 19, 2009 5:07 am
Hey everyone.
I'm writing an AJAX filtering system. You can select options from checkboxes and my php script returns data relating to the options, dynamically.
I want to add a 'select all' option to the checkbox group. The way it works currently is that when the user clicks a checkbox, its ID number is added to an array, which is then turned into a comma separated string and sent to my script, where I use it like:
SELECT * FROM table WHERE fieldID IN ($string)
I tried giving my 'select all' box a value of * but doing something like:
WHERE IN (2, 3, *) or even WHERE IN (*) doesn't work - any ideas on getting this to work?
Matt
I'm writing an AJAX filtering system. You can select options from checkboxes and my php script returns data relating to the options, dynamically.
I want to add a 'select all' option to the checkbox group. The way it works currently is that when the user clicks a checkbox, its ID number is added to an array, which is then turned into a comma separated string and sent to my script, where I use it like:
SELECT * FROM table WHERE fieldID IN ($string)
I tried giving my 'select all' box a value of * but doing something like:
WHERE IN (2, 3, *) or even WHERE IN (*) doesn't work - any ideas on getting this to work?
Matt