PDA

View Full Version : Cron job for SQL



Hitman
30-12-2007, 10:36 PM
Hey,

I have a row in a sql table, and I want to know how I can empty it or set all of them back to zero.

IE

UPDATE `users` SET `reptime` = 0 WHERE `id` = *
(not sure if that's 100% right, the last part)

but how would I do it with a cron job?

Cheers!

MrCraig
30-12-2007, 10:55 PM
UMMM.

I think theres a way to do it if you put the command in the file and get the cron job to run the file..

But i have no idea how.

EDIT:

Put it in a file, then do the cron command

php -f /home/YOUR ACCOUNT USERNAME/public_html/PATH TO FILE

Hitman
30-12-2007, 11:51 PM
UMMM.

I think theres a way to do it if you put the command in the file and get the cron job to run the file..

But i have no idea how.

EDIT:

Put it in a file, then do the cron command

php -f /home/YOUR ACCOUNT USERNAME/public_html/PATH TO FILEThanks! I shall test it.

Hitman
31-12-2007, 10:22 AM
I'm adding info! Plus can't edit.

That didn't work. :(

I have the file named cron1.php, with the code in it. So when I visit the page it executs it. I now understand the cron command needs to be something where a browser on the server visits this page. What would be the commad for that?

Want to hide these adverts? Register an account for free!