Can anyone spot any issues with this query? I wrote it and I thought it worked, but there are some issues with it it seems. What I have basically is checkboxes and usergroup names next to each checkbox. When you check each usergroup it sends an email.
PHP Code:
$usergroups2 = $vbulletin->db->query_read("
SELECT email, username, usergroupid, membergroupids
FROM " . TABLE_PREFIX . "user
WHERE usergroupid IN ($groupids)
OR membergroupids IN ($groupids)
OR FIND_IN_SET('$groupids', membergroupids)
");
My problem is...if I select Administrators for example and "Custom Group", I can only get it to print out the 2 people who are apart of the Administrators group. The additional users (4) of them who are apart of the "Custom Group" do not print out on my screen even though they should. 6 total should actually.
I don't get why the query wouldnt work entirely. If I select only the custom group and not the Administrators, then the 4 people show up fine.
--------------- Added [DATE]1254931725[/DATE] at [TIME]1254931725[/TIME] ---------------
I think I've figured out that my FIND_IN_SET is wrong. You can only search 1 value, not multiple. So how do I get around that?