Swapping round rows & columns

 

"; print "

In the normal order (i.e. rows & columns as per the database).

"; print ""; //Iterate through each record in the results set //pulling out one record as an associative array (i.e. a set of field/value data) per iteration: foreach($row as $resultArray) { print ""; //Iterate through each field in the current record: foreach ( $resultArray as $key=>$val ) { print ""; //Assign the value for the current field to an array in the fieldHash[currentfield] element. //Note the new array element is given an index number 1 higher than the current highest index. $fieldHash[$key][] = $val; } print ""; } print "
iddatetomScoredickScoreharryScore
$val
"; print "

 

"; print "

Now the 1st column shows the field names & each other column shows a record

"; print ""; //Iterate through each field (i.e. each element in the fieldHash: foreach ( $fieldHash as $key=>$valArray ) { print ""; foreach ($valArray as $val) { print ""; } print ""; } print "
$key$val
"; ?>