Help - Search - Members - Calendar
Full Version: Updating A Value Within X Time Span
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
The Seventh Hokage
Hello All!

I'm currently trying to write a do while loop. Within this loop I want it to simply echo the value of a variable every second or so. My question is what date/time function can i use to distingish the length of time between each call? I looked over the date/time functs on w3schools.com and none seemed to fit my problem. Any help would be appreciated as usual.
-the 7th

*several mins later*

CODE
do
{
$future = ;// i need this to be 3 seconds into the future

$now = time ();

$later =($future-$now) ;

$seconds =(int) ($difference*3) ;
if($seconds==$later)
echo $_SESSION['HP'];
}
while (!$_SESSION['FGTEND']);//while the value is lessened.



i believe the above code will work if i can get the current time and add to the seconds to make it three seconds into the future. still looking up info about that tho. the plan is to put this in it[s own php file and run it using ajax


*about an hour later*

well that was an utter failure so im gonna resort to caveman tactics to give you an idea of what im trying to do.
check out the pretty pictures! I'm hoping it's so easy a caveman can do it... lol
swordz
$future = (time() + 3);

Or even $future = (microtime(TRUE) + 3);

swordz
The Seventh Hokage
ok. that works but it causes infinite loop errors on my page. is there any other way i can approach this problem?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.