Okay, suppose your query is something like:
$q = "SELECT user_name, first_name, last_name FROM user_table"
$r = mysql_query($q);
if($r) {
// we have query results, so
// start an array for each users data:
$users = array();
while($row = mysql_fetch_array($r)) {
$users[] = $row;
}
}
Now all the user dats us stashed in the $users array, which is in indexed array whose values are associative arrays. The $users[] array can be reset, sorted, whatever.
reset($users);
while(list($k,$v)=each($users)) {
echo "User Data: <br>";
while(list($ke,$va)=each($v)) {
printf("$k: $v");
}
}
You don't need to run the second query; all the data you need is already stashed in the array $users; which again, is an indexed array of associative arrays.
Have fun