query("SELECT * FROM comment ORDER BY bugid, dateline ASC"); while ($comment = $db->fetch_array($comments)) { if (!isset($replace["$comment[bugid]"])) { $replace["$comment[bugid]"] = array('initialreport' => $comment['commentid'], 'dateline' => $comment['dateline'], 'lastposttime' => $comment['dateline'], 'lastpostby' => $comment['userid']); } $replace["$comment[bugid]"]['lastposttime'] = $comment['dateline']; } foreach ($replace AS $bugid => $newfields) { $db->query("UPDATE bug SET initialreport = $newfields[initialreport], dateline = $newfields[dateline], lastposttime = $newfields[lastposttime], lastpostby = $newfields[lastpostby] WHERE bugid = $bugid"); echo "

Updated $bugid

"; } ?>