Foser Posted July 18, 2007 Share Posted July 18, 2007 I'm trying to make something that will do something liek this: every 5 minute add 1 to $var1 although i want it so when I leave my browser and come back 10 min later I want to have 2. how can this be done? <?php // time function everuy 5 min execute{ $starttime = 0; $var1 = $starttime++; ?> Thanks Also I'm trying to display the time using echo time(); its all numbers all together how i manipulate the (inside) of the time function? thanks Link to comment https://forums.phpfreaks.com/topic/60552-time-question/ Share on other sites More sharing options...
metrostars Posted July 18, 2007 Share Posted July 18, 2007 Doubt it can be done with PHP alone, What you will have to do is to use a HTML header <meta http-equiv="refresh" content="300" /> Then use PHP, the number will have to be stored in a session or txt file. You can use PHP to open the txt, find the current number, add 1 to it, and then write the new number to the file. or use a database. Link to comment https://forums.phpfreaks.com/topic/60552-time-question/#findComment-301221 Share on other sites More sharing options...
Foser Posted July 18, 2007 Author Share Posted July 18, 2007 I understand the number will have to be stored, but this is just an simple example to learn from and change once i know how everything works. Will that meta tag refresh my page if im on it for more than 300 secs or does it refresh when no ones there? Link to comment https://forums.phpfreaks.com/topic/60552-time-question/#findComment-301223 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.