Gossamer Forum
Quote Reply
Modify for Dbsql
Hi all....
was using this little script in dbman...but have upgraded to dbsql...
can't get it to work..believe me I've tried.....can anyone assist...I will pay...thanks Rob


sub auto_delete {
$days = 91;
$time = time() - ($days * 86400);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $daylight) = localtime($time);
my (@months) = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
($day < 10) and ($day = "0$day");
$year = $year + 1900;
$in{'Date-lt'} = "$day-$months[$mon]-$year";

open(FILE, "< $db_file_name") or &cgierr("can't open $db_file_name: $!");
$count++ while <FILE>;
close FILE;

$in{'mh'} = $count;
my ($status,@hits) = &query("mod");
for (0 .. $db_total_hits - 1) {
%tmp = &array_to_hash($_, @hits);
$in{$tmp{$db_key}} = "delete";
}
&delete_records;
}