what about...
$query="SELECT * FROM table"; $res=mysql_query($query, $conn);
$numrows = mysql_numrows($res);
for($i = 0; $i < $numrows; $i++) {
$array['id'][] = mysql($result, "id", $i);
$array['desc'][] = mysql($result, "desc", $i);
}
(although you could make this loop body general to cope with any field names by while(list..each)'ing through the fetch_array)
and then go through this new 2d array...
while(list($key1, $array2) = each($array)) {
print $key.":<br>\n";
// Go through the array of results
while(list($key2, $value) = each($array2)) {
print $key." -> ".$value."<br>\n";
}
}
which would give you the results like...
id
0 -> 1
1 -> 4
2 -> 6
desc
0 -> 'cheese'
1 -> 'chuff'
2 -> 'chin'
hope this helps, if i've not understood you properly, post back.
dom
🙂