ok I tried this code:
PHP Code:
$users = $db->query_read("SELECT userid, username, substr(username FROM locate(' ', username) + 1) as lastname FROM user WHERE usergroupid IN (6,9) ORDER BY lastname ASC ");
Gave me this error:
Code:
Database error in vBulletin 3.6.4:
Invalid SQL:
SELECT userid, username, substr(username FROM locate(' ', username) + 1) as lastname FROM user WHERE usergroupid IN (6,9) ORDER BY lastname ASC;
MySQL Error : 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 '(username FROM locate(' ', username) + 1) as lastname FROM user
Error Number : 1064
Thanks,
Itworx4me