I've done it this way:
$days = 3;
$date_gt = &get_date2(time() - ($days * 86400));
### Whats New ###
my $query = qq!
SELECT ! . join(",", @db_cols) . qq! FROM $db_table
WHERE DATE and DATE >= '$date_gt' ORDER BY ID DESC LIMIT 15
!;
$sth = $DBH->prepare ($query) or &cgierr("Unable to query database. Reason: $DBI::errstr. Query: $query");
$sth->execute or &cgierr("Unable to query database. Reason: $DBI::errstr. Query: $query");
while (@tmp = $sth->fetchrow_array) {
push (@records, @tmp);
}
$sth->finish;
for (0 .. 9) {
%rec = &array_to_hash($_, @records);
$whats_new .= "<a href=\"$db_script_link_url&view_records=1&ww=1&$db_key=$rec{$db_key}\">
$rec{'Field1'} $rec{'Field2'}, $rec{'Field3'}, f. $rec{'Vraagprijs'}</a>
";
}
This will give you a link to the last ten added records not older than 3 days.
Hope this helps
----------
Mart.