PDA

View Full Version : While Loop Frenzy


Kirk Y
06-24-2006, 04:02 PM
I'm in need of a little help with my while loop. I'm trying to display a page containing all the registered users' profile pictures. This is the code I'm currently using:

$users = $db->query_read("
SELECT *
FROM user
");

while ($userinfo = $db->fetch_array($users))
{
if ($vbulletin->options['usefileavatar'])
{
$userinfo['profilepicurl'] = $vbulletin->options['profilepicurl'] . '/profilepic' . $userinfo['userid'] . '_' . $userinfo['profilepicrevision'] . '.gif';
}
else
{
$userinfo['profilepicurl'] = 'image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $userinfo['userid'] . "&dateline=$userinfo[profilepicdateline]&type=profile";
}
$userinfopic = "<img src=\"" . $userinfo['profilepicurl'] . "\" alt=\"\" title=\"$userinfo[username]'s picture\" border=\"0\"";
$userinfopic .= ($userinfo['ppwidth'] AND $userinfo['ppheight']) ? " width=\"$userinfo[ppwidth]\" height=\"$userinfo[ppheight]\" " : '';
$userinfopic .= "/>";
}

The result of this code is that only the latest registered user's profile picture is being shown. I'm out of ideas, so thanks in advance for any help.

Adrian Schneider
06-24-2006, 04:25 PM
$userinfopic = "<img src=\"" . $userinfo['profilepicurl'] . "\" alt=\"\" title=\"$userinfo[username]'s picture\" border=\"0\"";That line is clearing it everytime. Change it to .=

Kirk Y
06-24-2006, 05:11 PM
Ha ha... of course it's something simple. Thanks SirAdrian.