Answer the question
In order to leave comments, you need to log in
How to run my sql php via cron?
as I understand it, I need to make a separate file file.php insert into it
<?php
$this->db->query("DELETE FROM `paygo` WHERE created_date < ".( time()-60*2 )); // через 30 минут
?>
Answer the question
In order to leave comments, you need to log in
Protect this file - remove read and write permissions from everyone, except for the user from whom it will be launched, this is the first point.
The second point is that you don’t need to pervert like that over time, MySQL has standard functions for working with them, incl. function NOW() - returns the current date/time...
*about permissions, these will be permissions 500, but about working with dates in MySQL - it's well written here.
oh, and don't put a closing ?> tag at the end of a PHP file unless there's non-PHP code in there, this can cause potential problems with junk output to the browser and should become a habit even if the script is running outside of the browser.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question