Hello I have a query to insert into a MYSQL table inside a for loop. I start off with a date say "2006-01-04" What I need is after the first time the query inserts the record to increment the day of the month by one day and know if we at the end of the month, to go to the next month. I read somewhere that adding 86400 to the date is a bad practice becasue of daylight savings. Is this true? And if so what is the best way to do this?
Right now I am trying this(only field to be concerned with in query is the one I am inserting $date into. THe rest I have handled.)
$date = $HTTP_POST_VARS["EvtYear"]."-".$HTTP_POST_VARS["EvtMonth"]."-".$HTTP_POST_VARS["EvtDay"];
for ($i = 0; $i > $diff; $i++)
{
$query = "insert into events values (NULL, ".$HTTP_SESSION_VARS["employee"].", '".$date."',".$from_hour.", ".$from_min.", '".$HTTP_POST_VARS["frommerid"]."',".$to_hour.",".$to_min.",'".$HTTP_POST_VARS["tomerid"]."','".$total."','".trim(addslashes($local))."',1)";
$result = @mysql_query($query);
$date = strtotime($date) + 86400;
$date = date("Y-m-d", $date);
}
I need the date in the MYSQL table to be in the format of Y-m-d so I convert the $date as of the previous insert to a time and add a day then convert it back. I am not thinking this is the best way. Any help would be great.
Thank you in advance.