> I want to get date from database, to increment ot decrement it with
> days, to show the date and after thath
> if user confirm it to save it to database.

There are a ton of ways you can do it. You can select the date and it's
inc/dec value in the same statement:

SELECT datecol, datecol + INTERVAL 1 DAY FROM yourtable WHERE ...

Display whatever you need, if the user agrees to the new day, then issue
an update query:

UPDATE yourtable SET datecol = datecol + INTERVAL 1 DAY WHERE ...

To make those queries dynamic, you can replace the '1' with a variable
and assign it's value in PHP to either -1, 1, 2, 3, etc...

$inc = -1;

UPDATE yourtable SET datecol = datecol + INTERVAL $inc DAY WHERE ... 


You can select out the date you have now, use strtotime() to make it
into a unix timestamp (which PHP works with), and date() to format it
however you want. If the user approves the new date, you can reformat
the unix timestamp back to a YYYY-MM-DD format with date() or use
FROM_UNIXTIME() in your query to insert/update the new date into the

---John Holmes...

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to