2009-07-14, 03:12 PM
2009-07-14, 03:14 PM
You could do:
Replace $uid with the variable the uid is assigned to.
$query = $db->simple_select("users", "username", "uid = '".$uid."'");
$username = $db->fetch_field($query, "username");
Replace $uid with the variable the uid is assigned to.
2009-07-14, 03:22 PM
Great success, thank you very much.
2009-07-17, 03:46 PM
Why would you do a query for this one?
MyBB has built in function get_user...
You can also access all other user vars with these lines, for example:
MyBB has built in function get_user...
$author = get_user($uid);
echo $authorr[username];
You can also access all other user vars with these lines, for example:
echo $authorr[avatar];
returns the URL to user's avatar...2009-07-17, 03:52 PM
(2009-07-17, 03:46 PM)Lennart Sauter Wrote: [ -> ]Why would you do a query for this one?
Because get_user($uid) returns every field in the row, when they just want the username. Do you go into a shop to buy one newspaper, and buy all of them while you're there?
2009-07-17, 04:02 PM
Okay, I agree
Better performance is a point, definately.
Kind regards
Lennart Sauter
Better performance is a point, definately.
Kind regards
Lennart Sauter