I have changed:
Code: Select all
u.user_id AS user_id, u.username AS username, u.user_colour AS user_colour, ug.group_id AS group_id
FROM
' . USERS_TABLE . ' AS u,
' . USER_GROUP_TABLE . ' AS ug
WHERE
ug.user_id = u.user_id
AND '. $db->sql_in_set('ug.group_id', $legends) . '
ORDER BY u.username ASC';
Code: Select all
u.user_id, u.username, u.user_colour, u.group_id
FROM
' . USERS_TABLE . ' AS u
WHERE
'. $db->sql_in_set('u.group_id', $legends) . '
ORDER BY u.username ASC';
And on both SQL versions we have a "Bug". The list doesn't appear with the correct order!
If I have: rui, miguel, Sara, Ana it appears:
Ana
Sara
miguel
rui
Culprit of lowercase and uppercase thing, so I've fix it:
Code: Select all
ORDER BY u.username ASC';
Code: Select all
ORDER BY UPPER(u.username) ASC';
Ana
miguel
rui
Sara
FINAL CODE:
Code: Select all
u.user_id, u.username, u.user_colour, u.group_id
FROM
' . USERS_TABLE . ' AS u
WHERE
'. $db->sql_in_set('u.group_id', $legends) . '
ORDER BY UPPER(u.username) ASC';