EchoFool Posted October 19, 2008 Share Posted October 19, 2008 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 More sharing options...
Barand Posted October 19, 2008 Share Posted October 19, 2008 sounds like startedFlight has value > now Link to comment https://forums.phpfreaks.com/topic/129092-keep-getting-negative-difference/#findComment-669336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.