You are here: Re: Create a 3,6,9 and 12 monthly schedule « PHP Programming Language « IT news, forums, messages
Re: Create a 3,6,9 and 12 monthly schedule

Posted by NC on 09/21/05 02:27

bigfella wrote:
>
> In MYSQL would like to produce a field for 3,6,9 or 12 months just
> containing the dates of every 7 days from the current date.

$months = 3; // or 6, or 9, or 12
$now = time();
$day = $now + 7*24*60*60;
$cutoff = strtotime("+$months months");
while ($day <= $cutoff) {
$date = date('Y-m-d', $day);
$insert = "INSERT INTO the_table SET date='$date'";
mysql_query($insert);
$day = $day + 7*24*60*60;
}

Cheers,
NC

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация