default command time schedule
CREATE EVENT event_name
ON SCHEDULE
EVERY {x}
{SECOND | MINUTE | HOUR | DAY | MONTH | YEAR | WEEK}
DO
{SQL COMMAND};
我自己的活动
$auto = "CREATE EVENT event_name
ON SCHEDULE
EVERY 50 second
DO
INSERT into mytable (id, account, date)
VALUES('$id', '$account','$date' )";
if(mysqli_query($conn, $auto)){
echo '<script>alert("Data success to save !")</script>';
}
else{
echo '<script>alert("Data failed to save !")</script>';
}
;
代码应该可以正常工作,但查询没有添加到mysql表中
我错过了什么?
1条答案
按热度按时间4dc9hkyq1#
你应该跑
SET GLOBAL event_scheduler = ON;
在mysql中启动预定事件。为了阻止它,请退出SET GLOBAL event_scheduler = OFF;