<?php
 $recordsCountSQL="SELECT COUNT(*) FROM `$reportTable`"; $recordsCount=$db->GetOne($recordsCountSQL); if ($db->ErrorNo()) killReport("Could not run SQL in report. SQL: ".$recordsCountSQL); $groupSize=4000; for($startGroup=0;$startGroup<$recordsCount;$startGroup+=$groupSize) { refreshReportStatus('loopRecords', 'updateRecords', $startGroup/$recordsCount*100); $listResultsSQL="SELECT * FROM `$reportTable` LIMIT $startGroup, $groupSize"; $listResults=$db->GetAll($listResultsSQL); if ($db->ErrorNo()) killReport("Could not run SQL in report. SQL: ".$listResultsSQL); foreach($listResults as $row) { $updateFieldsArr= []; if ($tableColumns['extraDataList'] && $row['extraDataList']){ $thisExtraDataStr=""; $thisExtraData=unserialize($row['extraDataList']); foreach($thisExtraData as $name=>$value){ $thisExtraDataStr.=htmlClean($name).": ".htmlClean($value)."&#10;"; } $updateFieldsArr[]="`extraDataList`='".$thisExtraDataStr."'"; } if ($updateFieldsArr) { $updateFieldsSQL="UPDATE `$reportTable` SET ".implode(', ', $updateFieldsArr)." WHERE id='".$row['id']."'"; $updateFieldsEx=$db->Execute($updateFieldsSQL); if ($db->ErrorNo()) killReport("Could not run SQL in report. SQL: ".$updateFieldsSQL); } } } unset($listResults); ?>