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? Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/129092-keep-getting-negative-difference/#findComment-669336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.