MySQL is my weak point. I have the following MySQL query on a page of mine. The variables $this_groupMembers and $this_groupInvites are both predetermined strings in the form ‘1,2,3’ etc.:
SELECT
username
FROM
chat_users
WHERE
ID IN($this_groupMembers) OR
ID IN($this_groupInvites)
What I need to be able to do is to group the results so that I can access the existing members separately from the invited members. I.e. Create the variables $groupMembers_usernames and $groupInvites_usernames from the results of the MySQL query without having to dissect the results with PHP.
Is there a way to do this so that MySQL does all the work?
Thanks you,
Joe
You can use a UNION with constants to classify the returned rows: