Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
//update the timer and db
Old 03-25-2009, 12:21 AM //update the timer and db
Junior Talker

Posts: 1
Name: Harris
Trades: 0
This is to update the timer in my DB and let the user know how much time they have left in the hospital in a game.

Is there a way to make this more accurate? For some reason once in a while the timer is getting stuck and not telling people the time is counting down.

please help!

Code:
   $thetime = time();

   $result2 = mysql_query("UPDATE `updates` SET `lastdone` = '".$thetime."' WHERE `name` = 'hospital'");

   $leftovertime = $timesinceupdate - (floor($timesinceupdate / 60) * 60);

   if ($leftovertime>0) {

      $newupdate =  time() - $leftovertime;

      $setleftovertime = mysql_query("UPDATE `updates` SET `lastdone` = '".$newupdate."' WHERE `name` = 'hospital'");

   }
LOUDMOUTH is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-25-2009, 03:54 AM Re: //update the timer and db
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
php is done once the page has been sent to the browser, so the timer will stop.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to //update the timer and db
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.81548 seconds with 12 queries