PHP script for Cronjob

D

dkleinfeldt

Guest
Hello,

I am wanting to develop a PHP script that can be used with a Cronjob to delete records in a database that are older than 60 days. I am relatively new to PHP and MySQL so I'm not sure where to start. Can anyone help me write the script?

Any help would be greatly appreciated.

Thanks
Derek
 
Derek, you've got a couple of things going on here: 1) you need a php script to delete the records, then 2) you need to schedule it with cron (or some other means).

You'll need a field in your table to store the age of the record. Do you have that? If not, you'll need to modify your database structure and enter that data.

If it were me, I'd develop the script first, test it, and then when I was sure it was working, I'd automate it. You can use Windows Task Scheduler on a local PC (ie, at your place). Or, you can create a cron job via your control panel.

Tim
 
hi,
if you have php installed as a cgi, then you can call it as you would another cron job.

if not then you could use lynx - try this post for more info:
htmlcenter.com/tutorials/tutorials.cfm/155/PHP/
 
Back
Top