I’ve been attempting to adjust a mysql SELECT statement based on input from checkboxes. The php code collects the ticked checkboxes into an array, implodes them into a comma-separated list and then runs the query using an in statement (as was detailed here).
The query generated comes out as SELECT * FROM events WHERE Discipline IN (SJ,OTHER) which is a correctly formatted query as far as I can tell.
This shows up as an invalid query when run from the php code. When I run the query using phpmyadmin, I receive this message:
#1054 - Unknown column 'SJ' in 'where clause'
I was wondering if anyone could tell my why that query is generating the error?
Try putting quotes around the values in the IN clause: