The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
MySQL: Getting Username from UserID
Hi guys,
I am working on a plugin which will show the latest awards recently given, but the database does not contain the member's username. It only contains the user ID. Is there a way to get the username from the userID? Here is my current code: PHP Code:
|
#2
|
||||
|
||||
[sql]SELECT award_user.issue_id, award_user.award_id, award_user.userid, award_user.issue_reason, award_user.issue_time, user.username
FROM " . TABLE_PREFIX . "award_user AS award_user LEFT JOIN " . TABLE_PREFIX . "user AS user ON (userid) ORDER BY issue_id DESC LIMIT $limit[/sql] |
#3
|
|||
|
|||
MMM for some reason this isn't giving me any results back... Sorry I'm new to this mySQL stuff!
|
#4
|
||||
|
||||
Sorry, wrong query.
[sql]SELECT award_user.issue_id, award_user.award_id, award_user.userid, award_user.issue_reason, award_user.issue_time, user.username FROM " . TABLE_PREFIX . "award_user AS award_user LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid) ORDER BY issue_id DESC LIMIT $limit[/sql] Replace your query with mine, then you can access the username using $row['username']. |
#5
|
|||
|
|||
Ahh! Works great!!!! Thanks so much !!! Now the fun part begins .... editing the templates
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|