I'm posting a form with a date variable in it (date_start). The posted date format is YYYYMMDD.
When writing to the datebase, I want to add 7 days to this date and write it to the date_end column.
Basically, I want to write date_end = date_start + 7 days.
I have tried several PHP and MySQL solutions, weeded through countless forum postings and not found the solution that works.
My latest try is this:
INSERT INTO table ( date_end )
DATE_ADD( '$date_start', INTERVAL 7
but it gives me an error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4
My server is running PHP 4.4.9 and MYSQL 5.0.67,
Thanks for any help.
Echo the query and check that $date_start actually contains a value
Thanks, my $date_start was empty because of a typo further up in the code. Stupid mistake. Thanks for your help.