My objective is...
If the date is expired... the script gives 1 more day to the user, then if not subscribed, the user data is deleted.
How can I do it?... I tried INTERVAL 1 DAY, but... I don't know if works...
// Check Expire Dates and Delete Expired 1 day after.
$now = date('Y-m-d');
if ($row['expire_admin'] > $now)
{
echo " <a href='#' id='profileGhost'> ". $row['expire_admin'] . "</a>";
}
else
{
echo " <a href='#' id='profileGhost'>Expired.</a>";
$queryExpire = "DELETE FROM public_vips WHERE expire_admin(expire_admin, INTERVAL 1 day), steamid='$steamID'";
$expiredQ = mysqli_query($db, $queryExpire);
}
// Check Expire Dates and Delete Expired 1 day after.
$now = new DateTime();
$tomorrow = new DateTime();
$tomorrow->add( new DateInterval( 'P1D' ) );
$expiration_date = DateTime::createFromFormat('Y-m-d', $row['expire_admin'] );
if ( $expiration_date->format('u') > $now->format('u') )
{
if( $expiration_date->format('u') < $tomorrow->format('u') )
echo " <a href='#' id='profileGhost'> ". $row['expire_admin'] . "</a>";
}
else
{
echo " <a href='#' id='profileGhost'>Expired.</a>";
// I suppose that steamID is the unique id of the row you are currently check
$queryExpire = "DELETE FROM public_vips WHERE steamid='$steamID'";
$expiredQ = mysqli_query($db, $queryExpire);
}
}
Your SQL should probably be
DELETE FROM public_vips
WHERE expire_admin(expire_admin, INTERVAL 1 day)
AND steamid='$steamID'