Okay, so I’m making an online text-based game, and I’m stuck right now with an on completion:
function....
// I can't get this script to execute when I know the time has passed.
$now = new DateTime("now", new DateTimeZone('UTC'));
$row_date = new DateTime($row["due_date"], new DateTimeZone('UTC'));
if ($row_date->format('Y-m-d H:i:s') <= $now->format('Y-m-d H:i:s'))
{
mysql_query(".....")VALUES ("....")or die(mysql_error());
mysql_query("DELETE FROM ......")or die(mysql_error());
}
else
{
// The time has not come yet.
}
This code is to be executed every 10 seconds with jQuery’s setInterval.
DateTimeis compareable