19spartan94 Posted January 14, 2009 Share Posted January 14, 2009 Hey i was wondering guys, if anyone out there wud hlp me? I need to make a script that makes a row in one of my tables go up by 1 every 5 minutes... help much appreciated thanks, spartan Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/ Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You'll need to google Linux cron tutorial. With cron you can schedual the execution of scripts. Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736833 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ok thanks, wat iz that thing? Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736834 Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 Google it and find out. Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736836 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ok thanks, how do i add this into a PHP/HTML script? Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736841 Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You don't. Cron executes scripts/commands at a given time. All you need do is write a script to execute your query, then have cron execute this script every five minutes. Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736842 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 so just write a script and save it as script.sh and then make a con thing like this:? 0,10,20,30,40,50 * * * * /bin/execute/this/script.sh Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736844 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ...? Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736845 Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 Something like that. Your syntax is all wrong, but I'm sure if you research it you'll find that out. You shouldn't even need any script as updating mysql is a pretty simple process. The syntax would be something like.... 5 * * * * /usr/bin/mysql -uYOURUSERNAME -pYOURPASS YOURDATABASE -e "UPDATE tbl SET fld = fld + 1;' Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736846 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 ya ok BUT how do i add it to my script? do i just make a new file and save it as something? if so wat do i save it as? Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736848 Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You don't add it to any script. You need to add it to your crontab. Most hosts provide some type of web interface to do this, or if you have shell access simply type.... crontab -e Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736851 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 i cant find shell access OR crontab Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736852 Share on other sites More sharing options...
19spartan94 Posted January 14, 2009 Author Share Posted January 14, 2009 oh yer i just found it do i add a key? Link to comment https://forums.phpfreaks.com/topic/140779-help-needed-with-php-mysql/#findComment-736854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.