|
|
|
|
![]() ![]() |
Jan 11 2007, 07:02 PM
Post
#1
|
|
|
ITS ALIVE.....MUHHHAAAA ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 532 Joined: 17-October 05 From: Chippenham UK Member No.: 13,031 |
Ok i need to execute an sql query at a certain time of day and they only way i think this can be achieved is through a cron. The only problem is that i haven't a clue how to do it.
Code: CODE UPDATE trap17_ipbmembers SET points = points - 1 WHERE mgroup = 3 thats the SQL code but i need that executed at a certain time on a certain database every day. can anyone help me as i have know knowledge of cron what so ever - have a fealing i need to do that database bit in php but im not sure what code to put in as it will interact with cron. Help... |
|
|
|
Jan 12 2007, 01:10 AM
Post
#2
|
|
|
$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 6,448 Joined: 21-September 04 From: 9r33|\| 399$ 4|\|D 5P4/\/\ Member No.: 1,218 ![]() |
I am assuming your not using cpanel, if you are you could set them up that way. any ways I thought I toss this little code up for you
http://www.sitepoint.com/article/introducing-cron it's a series of php scripts and some mysql that should get it going for you. |
|
|
|
Jan 12 2007, 07:05 PM
Post
#3
|
|
|
ITS ALIVE.....MUHHHAAAA ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 532 Joined: 17-October 05 From: Chippenham UK Member No.: 13,031 |
well i am using cpanel. cpanel cant execute sql queries from cron so id need a php script that had all the data in it then set cron to run the php script at a certain time of day
|
|
|
|
Jan 12 2007, 07:38 PM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 212 Joined: 15-September 06 Member No.: 30,028 |
Yup. You need to get the cron job to run the PHP
I use something like this. CODE 0 0 * * * /usr/bin/php -q /home/yacoby/public_html/path/to/php/file.php > /dev/null (If you set up the cron job under the Unix style interface, you will see that there are boxs for the 0s and *s, and then one big text input for this: CODE /usr/bin/php -q /home/yacoby/public_html/path/to/php/file.php > /dev/null CODE /usr/bin/php This is the path to PHP. CODE -q Quite. The > /dev/null might make it so you don't need this. CODE /home/yacoby/public_html/path/to/php/file.php The path from your top directory to the PHP file CODE > /dev/null I think this makes it so that the output is deposed of. Not sure though. Inclding something like this: CODE if ($REQUEST_URI){ print "Access forbidden!<br>"; exit; } At the top of the script would, I think, make it so the script can't be run from your browser, it has to be run via the cron job. Hopefully this will have helped. I don't know very much at all on this subject. This post has been edited by Yacoby: Jan 12 2007, 07:41 PM |
|
|
|
Jan 13 2007, 06:46 PM
Post
#5
|
|
|
ITS ALIVE.....MUHHHAAAA ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 532 Joined: 17-October 05 From: Chippenham UK Member No.: 13,031 |
Thanks got it working
Mod close topic |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 7th September 2008 - 03:35 AM |