Greetings Geeks, I wanted to know if it would be possible to write a simple PHP script if I'd like to change a certain part of one of my PHP files automatically at a specified time of my choice, this should keep repeating every 24 hours or so to ensure stability. I also need a countdown sort of a thing to let the user (person who views the PHP file) know as to how many hours, minutes and seconds are left for that particular code to be changed. I'd really appreciate some help from all you PHP expers out there! Thanks a lot!
This sounds very easy, what is the content you want changed? you could simply have a database with the content in tell it what time to start showing that piece of content and query it for the correct one to show. the count down would be best done with javascript, with just a count down script and have the start or end time generated by PHP...
I just want 1 particular digit to be changed every 24 hours in a progression. Like 1, after 24 hours I want that digit changed to 2, after 24h to 3 and so on until 5 and it should go back to 1 after it reaches 5. Would you please elaborate more on how I could implement the above methods? Your help is greatly appreciated! Best Regards, Karan
all you have to do is just save it into database , the things you need to save in database is day, value $day=date("m"); and value is the value that have been saved in db !every time load it and check the date if it's different add to value.
o well thats well easy.. All u need is one db table with: id | Number | change Datetime and have a PHP script like: <?php $result = mysql_query("SELECT * FROM table WHERE id='1'"); $row = mysql_fetch_array($result); $date = strtotime($row['datetime']); //If last change date plus 24 hours is less than current time if(($date + (60*60*24)) < date('U')) { if($row['number'] == '5') { mysql_query("UPDATE table SET number='1', change_datetime='{date('Y-m-d H:i:s')} WHERE id='1'"); } else { $no = $row['number']++; mysql_query("UPDATE table SET number='$no', change_datetime='{date('Y-m-d H:i:s')} WHERE id='1'"); } echo $no; } else { echo $row['number']; } ?> and that should do it. PHP: