1

I have tried many times now but i just dont seem to be able to crack it!

I have set up a cron job on cpanel (was every minute for testing) with the command set at

/php cronjobcommand.php

In my cronjobcommand file i have the following code

<?php//conenct to your DB
$db_conn = mysql_connect('localhost', 'xxxxx', 'xxxxx');
mysql_select_db('xxxxx', $db_conn);


$result = mysql_query("DELETE FROM 'data' 
  WHERE 'offerends' < CURDATE()}
                               LIMIT 1", $db_conn);
    //might want to check here to see if the query executed successfully

?>

I want it to delete any rows that have a date of less than today at midnight each night. what am I doing wrong? The job seems to find my file fine, i get my email without errors, but no difference to database.

Thanks Jamie.

4

1 回答 1

4

使用Adminer或PHPMyAdmin对你的数据库运行这个

SELECT * FROM 'data' WHERE 'offerends' < CURDATE() LIMIT 1

这将为您提供匹配的行,然后您可以使用此查询进行调试,这可能更容易。

您的 DELETE 查询中似乎也有一个迷路}

于 2013-07-18T23:55:00.447 回答