PDA

View Full Version : from user id to username


Blue2000
10-25-2001, 12:45 AM
first of all am working on a game for vb called subber

i have made it so that when they submit it it will recode there user id into a table called "subberuserid"

but the problem i have now is in the display of subber i can only get it to show the userid and not the username. i have looked at the tables for private messaging and posts and i notice that all you have there is the user id aswell and not the username.

so how would i turn it from userid to the username?

thanks for you help

Palmer ofShinra
10-25-2001, 07:59 AM
$subber=$DB_site->query_first("SELECT username,userid,usergroupid FROM user WHERE userid=$userid");
echo "$subber[username], your user id is $subber[userid] and your User Group ID is $subber[usergroupid]. Isn't that nifty?";

username,userid,usergroupid is where you choose the fields you want.

Just add the fields you want to select seperated by commas (and no spaces).

The returned array will have matching elements based on that, as my example shows.

Note this will always return an array, even if you're only selecting username.

You have to call the script properly too...

.com/forum/subber.php?action=home&userid=$bbuserinfo[userid]

If you don't pass userid= in the URL, your script will have an undefined variable, which is bad.