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
https://forums.phpfreaks.com/topic/129092-keep-getting-negative-difference/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.