Not logged in
Home/Tutorials/Automated Cron Job Script
10 months ago
Automated Cron Job Script
Content by: Steve Stewart
Posted 10 months ago with 200 views
How to automated php scripts using a Cron Job, you can do this for any script from deleting old record in you're database to sending out mass emails to you're members.
In this tutorial, we are just going to do an update every day, so lets start off with some php.
The code below is an update script, firstly create a folder and call it: mycronjobs
Once you've done that, save the code below as: update_cron.php and upload the folder with the cron script to you're server.
This is very basic and will change the siteinformation name row in you're database and will start you off using cron jobs.
mysqli_qurey($db_conx, "UPDATE `siteinformation` SET `name`='MyUpdated Site Name'");
Now goto you're hosting provider and in you're cPanel Control look for Cron Jobs. (Depending on hosting provider will depend on the layout).
In most instances you can select by dropping the box "Common Settings", and select Once a Day.
Then you need the root path to the script and as you see in mine, General example, I copy it all and paste it into the Command line, changing the part after "public_html" to the folder created, "mycronjobs" and the php file itself.