Jump to content

Keep getting negative difference


EchoFool

Recommended Posts

Don't know why but i keep getting a negative difference with my script.

 

It compares the time from a timestamp in the database to now then shows it on the screen but it decides to show a negative number that gets less and less rather than greater than ... using the timediff function.... heres the script:

 

<?php
//StartedFlight example: 2008-10-19 10:00:00

$Get = mysql_query("SELECT TIMEDIFF(NOW(), StartedFlight) AS MinutesPassed FROM userregistration 
				WHERE  UserID='{$_SESSION['Current_User']}'")
				or die(mysql_error());
$row2 = mysql_fetch_assoc($Get);
?>
Flght Length: 02:00:00
<br>
Current Flight Time: <?=$row2['MinutesPassed']?>
<br><br>
?>

 

As time goes by from the started time stamp the minutes passed gets less and less and shows something like this:

 

- 00:02:00

then

- 00:01:58

 

etc it should be doing the opposite of that and go upwards. Where have i gone wrong?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.