Gossamer Forum
Home : Products : DBMan : Customization :

Display the records before and after todays today

Quote Reply
Display the records before and after todays today
Hi,

Me again!
I've got a match database at:
http://www.mancity.net/Test/fixtures.html
and if you look near the top of the page, you'll see there's a link to the last and next match (this will hopefully be generated from the database).
Sooo, I was wondering, is there any way I can display the record previous to todays date, and the record next to todays date?

Ta.

Scall

Quote Reply
Re: Display the records before and after todays today In reply to
This would require a separate subroutine. It couldn't be done just with one search.

The "guts" of the new subroutine would be:

Code:

$in{'mh'} = 1;
$in{'sb'} = the number of your date field;

$in{'Date-lt'} = &get_date;
$in{'so'} = 'descend';
my ($status,@before) = &query('view');
push(@hits,@before);

$in{'Date-lt'} = '';
$in{'Date-gt'} = &get_date;
$in{'so'} = 'ascend';
my ($status2,@after) = &query('view');
push(@hits,@after);

my ($numhits) = 2;
At that point, the subroutine would be the same as sub html_view_success.

JPD
http://www.jpdeni.com/dbman/