Page 1 of 1

increment date

Posted: Thu Jun 01, 2006 4:03 pm
by dujed
Can you you help me please,I have following code:

do
{
$sql='INSERT INTO rezerv (date,ime) VALUES ($_POST["date1"],$_POST["ime"])';
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Success!";
********in this place I need increment "date1" for 1 day********
*******format for date is year,month,day******************
}

while (($_POST["date1"]) != (($_POST["date2"])

thanks!

Re: increment date

Posted: Thu Jun 01, 2006 8:44 pm
by RobertGonzalez
Please use PHP tage when posting PHP code. Thanks. This is how it should look. See comments at the bottom...

Code: Select all

<?php
do
{
	  $sql='INSERT INTO rezerv (date,ime) VALUES ($_POST["date1"],$_POST["ime"])';
       if (!mysql_query($sql,$con))
         {
           die('Error: ' . mysql_error());
         }
     echo "Success!";
********in this place I need increment "date1" for 1 day********
*******format for date is year,month,day******************
}

  while (($_POST["date1"]) != (($_POST["date2"])
?>
Have you looked at the mysql date() function? Or how about the PHP strtotime() function coupled with the PHP Date() funtion?