PerlElvir
Technical User
- Aug 23, 2005
- 68
HI all, I have this situation: I want to get all dates between curent date and 30 days, so I want to get now:
2006-05-22
2006-05-23
2006-05-24
2006-05-25
2006-05-26
.
.
.
2006-06-21
Now I use this script and I get only last date 2006-06-21.
SO can some one help
#!/usr/bin/perl -w
use DBI;
sub jet_emul()
{
$dbh = DBI->connect("DBI:mysql:acerigel:localhost", "root", "");
$query = "SELECT DATE_ADD(CURDATE(),INTERVAL 30 DAY);";
my $sth = $dbh->prepare($query);
$sth->execute();
while (my @date = $sth->fetchrow_array())
{
$g_date_fin = $date[0];
print $g_date_fin."\n";
}
$sth->finish();
$dbh->disconnect();
}
jet_emul();