#!/usr/local/bin/php -q getrow(); while(is_array($rec)){ echo $rec["name"]; $table=$rec["table"]; $cutoff=date("Y-m-d", mktime(0,0,0,date('m'),date('d')-$nDays)); $sSQL="Select id from $table where datestamp < $cutoff and thread=id"; $q->query($DB, $sSQL); $numthreads=$q->numrows(); $instr=""; while($rec=$q->getrow()){ $instr.="$rec->id,"; } if($instr) $instr=substr($instr, strlen($instr)-1); $sSQL="Select count(*) as cnt from $table where thread in ($instr)"; $q->query($DB, $sSQL); $cnt=$q->getrow(); $count=$cnt["cnt"]; $sSQL="Delete from $table where thread in ($instr)"; $q->query($DB, $sSQL); $sSQL="Delete from $table"."_bodies where thread in ($instr)"; $q->query($DB, $sSQL); $rec=$res->getrow(); if($VERBOSE) echo "Forum: $rec[name], Threads Deleted: $numthreads, Messages Deleted: $count\n"; } ?>