How can i assign the result for the return of user.username to a variable in this function?
function fetch_avatar_url($userid)
{
global $DB_site, $session, $vboptions;
if ($avatarinfo = $DB_site->query_first("
SELECT user.avatarid, user.username, user.avatarrevision, avatarpath, NOT ISNULL(avatardata) AS hascustom, customavatar.dateline
FROM " . TABLE_PREFIX . "user AS user
LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON avatar.avatarid = user.avatarid
LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON customavatar.userid = user.userid
WHERE user.userid = $userid"))
{
if (!empty($avatarinfo['avatarpath']))
{
return $avatarinfo['avatarpath'];
}
else if ($avatarinfo['hascustom'])
{
if ($vboptions['usefileavatar'])
{
return "$vboptions[avatarurl]/avatar{$userid}_{$avatarinfo[avatarrevision]}.gif";
}
else
{
return "image.php?u=$userid&dateline=$avatarinfo[dateline]";
}
}
else
{
return '';
}
}
}
Im used to seeing mysql query's and i know this use's a mysql database im just kind of confused right now.