The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Database Query Question
Hello,
I have people sign up using there Real Name on my forum. I am using this code to pull some info from the database. PHP Code:
Thanks, Itworx4me |
#2
|
|||
|
|||
Quote:
As for a php loop, you could have it slit the username into two arrays at the space and return an order like that. Honestly I don't know the details on coding something like that myself, but I would think it can be done. Probably not worth the work unless it's EXTREMELY important. |
#3
|
||||
|
||||
Try this,
Code:
SELECT userid, username, substr(username FROM locate(' ', username) + 1) as lastname FROM user WHERE usergroupid IN (6,9) ORDER BY lastname ASC |
#4
|
||||
|
||||
ok I tried this code:
PHP Code:
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 Itworx4me |
#5
|
||||
|
||||
Hm... MySQL version? Try "substring" instead of "substr".
|
#6
|
||||
|
||||
Thanks for the code SirAdrain. It worked.
Thanks, Itworx4me |
#7
|
|||
|
|||
very nice man, I did not know you could do that!
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|