dhimok Posted February 21, 2007 Share Posted February 21, 2007 Hey there. I have a question if u might help me I want to update a database record using time as a trigger and I want this to happen automatically in the database thru a php file on the server. lets say I have 2 time vars: $now = time(); $expire = 1173697245; what I want to accomplish is this: if($now >= $expire) { mysql_query("UPDATE table SET bla bla "); } I want this to be triggered autaomatically. How can I do that. How can I set a trigger? Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/ Share on other sites More sharing options...
jcbarr Posted February 21, 2007 Share Posted February 21, 2007 That will only work if you access the page after the deadline. Then the script will execute the command. I think what you want is a cron job. Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190888 Share on other sites More sharing options...
dhimok Posted February 21, 2007 Author Share Posted February 21, 2007 Hehe, I was just wondering if it is possible that php some how excesses the page and executes automatically right after $now >= $expire without having to use $_POST or $_GET Request and without actually browsing the page Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190891 Share on other sites More sharing options...
jcbarr Posted February 22, 2007 Share Posted February 22, 2007 That is what a cron job does. It will run the script at a specified time and execute the code that is contained within. Check with your host to see if you are able to set up these types of events. Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190895 Share on other sites More sharing options...
dhimok Posted February 22, 2007 Author Share Posted February 22, 2007 right now I am working on a local server so i can manage the server, how do I do that? Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190898 Share on other sites More sharing options...
jcbarr Posted February 22, 2007 Share Posted February 22, 2007 Now you have left my realm of knowledge. I have only done this using cPanel on a web host that I pay for, I have never actually managed my own server. I'm sure someone will be able to asnwer that question though. Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190907 Share on other sites More sharing options...
dhimok Posted February 22, 2007 Author Share Posted February 22, 2007 Ok, I have cpanel as well. How do i set it up there? Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190910 Share on other sites More sharing options...
jcbarr Posted February 22, 2007 Share Posted February 22, 2007 Check this page, it has some good information on how to go about it in cPanel http://www.siteground.com/tutorials/cpanel/cron_jobs.htm Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190913 Share on other sites More sharing options...
dhimok Posted February 22, 2007 Author Share Posted February 22, 2007 ok, thanks, I will check it out Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190914 Share on other sites More sharing options...
jcbarr Posted February 22, 2007 Share Posted February 22, 2007 For the command line, you would use something similar to this php -q /home/serverpath/script/file.php Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190916 Share on other sites More sharing options...
dhimok Posted February 22, 2007 Author Share Posted February 22, 2007 Ok I will write that down Link to comment https://forums.phpfreaks.com/topic/39560-help-with-automatic-update-of-mysql-using-time/#findComment-190921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.