次のphpコードをCRONジョブとして実行するように設定しています。1日に1回実行され、エラーが返されることはないため、正常に実行されていると思います。問題は、行がデータベースから削除されていないことです。
私はphpをテストし、変数が機能します。私は自分のクエリをテストしましたが、それも機能するので、途方に暮れています...
<?php
$isCLI = ( php_sapi_name() == 'cgi-fcgi' );
if (!$isCLI)
die("cannot run! sapi_name is ".php_sapi_name());
exit;
//Connect to DB
mysql_connect("xxxxxx.com", "xxxxxxxxxx", "xxxxxxxxxxxx") or die(mysql_error());
mysql_select_db("xxxxxxxxxxx") or die(mysql_error());
//Get today's date
$todayis = date("Y-m-d");
$todayis = strtotime(date("Y-m-d", strtotime($todayis)) . " -4 hours");
$todayis = date('Y-m-d', $todayis);
//Delete rows in userContests where reminder is less than or equal to today's date
mysql_query("DELETE FROM userContests WHERE reminder <= '$todayis';") or die(mysql_error());
?>
行が削除されない理由を誰かが私に説明できますか?