$maxSeconds order by total_time desc LIMIT $limit "; $result = Database::query($sql); $log = ''; while ($row = Database::fetch_array($result, 'ASSOC')) { $id = $row['iid']; $oldTotalTime = $row['total_time']; $sql = "UPDATE c_lp_item_view SET total_time = '$valueToUpdate' WHERE iid = $id;"; // Uncomment to fix if ($update) { Database::query($sql); } $oldTotalTime = round($oldTotalTime / 3600, 2); $report = "Previous total_time : ".$oldTotalTime." hours"; $report .= PHP_EOL; $report .= "New total_time: $valueToUpdate"; $report .= PHP_EOL; $report .= $sql; $report .= PHP_EOL; $report .= PHP_EOL; $log .= $report; echo $report; } if ($sendMessage && !empty($log)) { $log = nl2br($log); MessageManager::send_message_simple( $userId, 'LP time abusive fixes', $log, 1 ); }