|
Posted by NC on 11/15/87 11:27
bigfella wrote:
>
> could this be changed to produce a straight 31 days?
Of course:
$cutoff = strtotime('+31 days');
$now = time();
$day = $now + 24*60*60;
while ($day <= $cutoff) {
$date = date('Y-m-d', $day);
$insert = "INSERT INTO the_table SET date='$date'";
mysql_query($insert);
$day = $day + 24*60*60;
}
Read up on strtotime(), it's really powerful:
http://www.php.net/strtotime
Cheers,
NC
Navigation:
[Reply to this message]
|