定期的なイベント システムを作成しており、新しいイベントを作成するためにイベントが通過したかどうかを確認するためのチェックをハード コードする必要があります。(いいえ、システムベースがWindowsなので、cronジョブを作成できません。いいえ、タスクスケジューラにアクセスできません。)
これは私がこれまでに持っているコードです:
<?php
require('common.php');
$query = "SELECT
*
FROM
DD_events
";
try{
$stmt = $db->prepare($query);
$result = $stmt->execute();
}
catch(PDOException $ex){
die("Failed to run query: " . $ex->getMessage());
}
$chk = $stmt->fetchall();
//print_r($chk);
foreach ($chk as $chks) {
if (time() > $chks['event_date']) {
//Add 1 day to event time
$time = strtotime($chks['event_date']);
$newTime = $time + 86400; // 24 * 60 * 60
// Create query to make the next event
$query = "INSERT INTO
DD_events (event_name, event_date, initiator, min_lvl, max_level)
VALUES
({$chks['event_name']}, {$newTime}, 0, {$chks['min_lvl']}, {$chks['max_level']})
";
try
{
// These two statements run the query against your database table.
$stmt = $db->prepare($query);
$stmt->execute();
}
catch(PDOException $ex)
{
// Note: On a production website, you should not output $ex->getMessage().
// It may provide an attacker with helpful information about your code.
die("Failed to run query: " . $ex->getMessage());
}
}
}
次のエラーが返されます。
Failed to run query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 200)' at line 4
私は過去 30 分間エラーを見ていて、それを見ることができないので、誰でも私が作っているエラーを見つけることができますか?