Cron Job和phpAdmin触发器删除数据

时间:2017-02-24 19:30:32

标签: php cron

我已经尝试过cron作业和触发器在给定时间后删除数据但没有运气我在我的表中有一个名为timer的TIMESTAMP。

以下是我尝试过的代码。

代码我尝试了触发器

DELETE FROM wp_wpgmza WHERE timer <= NOW()

我为Cron Jobs尝试过的代码

dbonnect.php

<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$servername = "----";
$username = "----";
$password = "----";
$dbname = "-----";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

echo "Connected successfully";

?>


</body>
</html>

cronjobcommand.php

<?php 

     include('dbconnect.php');

     mysql_query("DELETE FROM wp_wpgmza WHERE timer < NOW()");

    ?>

Cron Jobs Command

/path/cronjobcommand.php

0 个答案:

没有答案