$sql = mysql_query("select id, name, code from users");
$userinfo = array();
while ($row_user = mysql_fetch_assoc($sql))
$userinfo[] = $row_user;
Esto le dará $userinfo
como una matriz con la siguiente estructura:
[
[id => 1, name => 'gorge', code => '2123'],
[id => 2, name => 'flix', code => 'ksd02'],
[id => 3, name => 'jasmen', code => 'skaod2']
]
Si desea generar los datos:
foreach ($userinfo as $user) {
echo "Id: {$user[id]}<br />"
. "Name: {$user[name]}<br />"
. "Code: {$user[code]}<br /><br />";
}