Hello Freaks!
First time poster, long time reader.
I'm making a simple standalone blog extension in mediawiki for work and am getting KILLED trying to use the IN() condition. Fighting with it recently actually made me realize I've never actually gotten one work before. EVER! I usually end up using a loop to build an outrageous looking bunch of OR's into a query string to get around it. This madness has to stop.
I've done everything I can think of to tweak the syntax. I still get query errors. Can anyone see what I'm doing wrong? From what I can see, I'm following the usage perfectly!
I have a table called simpleblog_perms looking something like this:
id (INT) group (TEXT) logid (INT) perm (TEXT)
--------- --------------- ------------ ------
1 Staff 1 R
2 sysop 1 W
The following queries all result in an error!
SELECT * FROM simpleblog_perms WHERE group IN (Staff,bureaucrat,sysop)
SELECT * FROM simpleblog_perms WHERE group IN (Staff, bureaucrat, sysop)
SELECT * FROM simpleblog_perms WHERE group IN ('Staff','bureaucrat','sysop')
SELECT * FROM simpleblog_perms WHERE group IN ('Staff', 'bureaucrat', 'sysop')
SELECT * FROM simpleblog_perms WHERE (group IN ('Staff','bureaucrat','sysop'))
They each return something like MySQL returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group IN ('Staff','bureaucrat','sysop')' at line 2 (localhost)".
I'm using MySQL 5.1.30 with PHP 5.2.9-2