Is it possible to use mysqls NOW()
function and add seconds to or from it?
Like so;
$q = $dbc -> prepare ("UPDATE account SET time = NOW() + $seconds WHERE id = ?");
Thanks
If you want to do this in MySql, you can either use
DATE_ADD(NOW(), INTERVAL $seconds SECOND)
or
UNIX_TIMESTAMP() + $seconds
You can add seconds to it with DATE_ADD()
:
$q = $dbc -> prepare ("UPDATE account SET time = DATE_ADD(NOW(), INTERVAL $seconds SECONDS) WHERE id = ?");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With