Gossamer Forum
Quote Reply
oldest and newest link
Hi,

I need a global that fetch the date of the oldest link ever added and the newest link in the following format: (based on Add_Date)

Code:
new Date(yyyy,m,d),new Date(yyyy,m,d)

where the first entry is the oldest link and the second one the date of the newest link added.

Any help would be appreciated.

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] oldest and newest link In reply to
Newest link date:
Code:
sub {
my ($output,$sth);
my $link_db = $DB->table('Links');
$link_db->select_options ('ORDER BY Add_Date DESC Limit 1');
$sth = $link_db->select ( { isValidated => 'Yes' } );
while ($link = $sth->fetchrow_hashref) {
$output = $link->{Add_Date};
}
return $output;
}

Oldest link date:
Code:
sub {
my ($output,$sth);
my $link_db = $DB->table('Links');
$link_db->select_options ('ORDER BY Add_Date ASC Limit 1');
$sth = $link_db->select ( { isValidated => 'Yes' } );
while ($link = $sth->fetchrow_hashref) {
$output = $link->{Add_Date};
}
return $output;
}


This is just a help point, where you can start developing the exact features you need.
If you want the 2 globals together, you can merge them and return oldest link and newest link, also you can add date formatting (I did not added date formatting by default).

Also the newest link value is available per category in Category table.
You just need to go though all categories and take the highest newest link dates.

I hope this helps you starting in good direction.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] oldest and newest link In reply to
Thanks - I got it sorted :-)

Klaus

http://www.ameinfo.com