Reply to wrong dates in a schedule

Your name:

Reply:


Posted by bigfella on 09/22/05 00:36

Hi Everyone,

I am using the following code (many thanks for the code folks BTW) to
generate 3 schedules in three tables one is a schedule with 7 day
intervals and two are daily schedules.

The two daily schedules seem to have out of sync dates at the start of
each schedule. The dates look as if they may be dates from the
preceding loop.

I am presuming that I need to reset something after the completion of
each loop but I am not sure what.

Many thanks

Darren

$now = time();
$day = $now + 7*24*60*60;
$cutoff = strtotime("+$months months");
while ($day <= $cutoff) {
$date = date('Y-m-d', $day);
$insert = "INSERT INTO daily_data SET subscr_id='$subscr_id',
date='$date'";
mysql_query($insert);
$day = $day + 7*24*60*60;
}
//then create a daily schedule in the excercise table
for($i=0;$i<=($sched);$i++)
mysql_query("INSERT INTO exercise_data SET subscr_id='$subscr_id',
date=date_add(now(),INTERVAL
LAST_INSERT_ID() DAY)");
//then create a daily schedule in the food and diet table
for($i=0;$i<=($sched);$i++)
mysql_query("INSERT INTO food_data SET subscr_id='$subscr_id',
date=date_add(now(),INTERVAL
LAST_INSERT_ID() DAY)");

[Back to original 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

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