> if(!($rs = mysql_query($q))) // querying > { echo "Query failed". mysql_error(); exit; } > > > $n = 0; > while ($line = mysql_fetch_assoc($rs)) { //dumping into an array > foreach ($line as $field => $value) { > $data[$field][$n] = $value; > } > $n++; > } > > and this is how i use the arrays values (blah is the field name): > $blah1=$data['blah'][0]; > $blah2=$data['blah'][1]; > $blah3=$data['blah'][2];
This should work. Try it and see. $n = 0; while ($line = mysql_fetch_assoc($rs)) { //dumping into an array foreach ($line as $field => $value) { $tmp = $field.$n; $$tmp = $value; } $n++; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php