rewind pointer after use

This commit is contained in:
2017-06-29 14:52:19 +10:00
parent c18752c56a
commit f786e02efa

View File

@@ -148,22 +148,19 @@ function booking_earlyaccess_csv_report() {
->orderBy('cid'); ->orderBy('cid');
$result = $codelist_query->execute(); $result = $codelist_query->execute();
foreach ($result as $record) { foreach (reset($result) as $record) {
foreach ($record as $key => $value) { foreach ($record as $key => $value) {
$header_array[] = $key; $header_array[] = $key;
} }
break; break;
} }
watchdog('booking_debug', "EarlyAccess CSV query result: @info", array('@info' => var_export( $result, TRUE)));
watchdog('booking_debug', "EarlyAccess CSV header: @info", array('@info' => var_export($header_array, TRUE)));
//calculate the header row for CSV //calculate the header row for CSV
$header = implode($delimiter, $header_array); $header = implode($delimiter, $header_array);
$csv .= $header . "\n"; $csv .= $header . "\n";
//add the records //add the records
foreach (reset($result) as $record) { foreach ($result as $record) {
$output = array(); $output = array();
//each keypair in the record //each keypair in the record
foreach ($record as $key => $value) { foreach ($record as $key => $value) {