I am having trouble adding 2 days to a date that is in the database. I have tried multiple ways around it but none of them are updating the database.
include('CONNECT-DB.php');
// check if the 'id' variable is set in URL, and check that it is valid
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
// get id value
$id = $_GET['id'];
// delete the entry
$id = $_GET['id'];
$result1 = mysql_query("SELECT `offerends` FROM `data` WHERE id=$id");
$date1 = str_replace('-', '/', $result1);
$date2 = date('y-m-d',strtotime($date1 . "+2 days"));
mysql_query("UPDATE `offerends` SET `$date2` WHERE id=$id");
I HAVE REVISITED IT, thanks for the suggestions this is the correct code that now works for my use.
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
$id = $_GET['id'];
$id = $_GET['id'];
$result1 = mysql_query("SELECT `offerends` FROM cheapest` WHERE id=$id");
$date2 = "DATE_ADD(offerends,INTERVAL 3 DAY)";
mysql_query("UPDATE `cheapest` SET offerends=$date2 WHERE id=$id");