I count the amount of columns (fields) in a DB, now I want to create an array for each column. Is this somehow possible? For example:
$num = mysql_num_fields($query);
for($i=0; $i<$num; $i++){ // loop 1
$field_names[] = mysql_field_name($query,$i);
}
for($i=0; $i<$num; $i++){ // loop 2
while($row = mysql_fetch_array($query)){ // loop 3
$array[] = $row[$field_names[$i]]
}
}
Now I basically want the $array[] variable to change every time loop 2 ends so that at the end of say 3 loops I'd have 3 different arrays. Is that possible? If so can someone please explain?