vangelisb Posted July 3, 2009 Share Posted July 3, 2009 Hello boys and girls i have a small problem with a script that i wrote for our virtual airline (Flight Simulator) This is for calculating the ours that our pilot fly online based by the reports that they send at the end of each flight that they fly. The time format in mysql is 00:00 i manged to sum it up but my problem is that it goes up to 838:59:59 ours is there a way to sum time and display it even if it is above 1000 Hours ? I quote the code that we are using at the present time <?php $con = mysql_connect("localhost","xxxxxx","xxxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dutchgl_Site", $con); $result = mysql_query("SELECT pilots.PRank, pilots.IDPilot, pilots.FullName, pilots.Country, SEC_TO_TIME(SUM(TIME_TO_SEC(pirep.flighttime))) AS flight FROM dutchgl_Site.pilots LEFT JOIN dutchgl_Site.pirep ON ( pilots.IDPilot = pirep.IDPilot ) GROUP BY pilots.IDPilot" ); echo "<table border='1'> <tr> <th>Rank</th> <th>Callsign</th> <th>Pilots name</th> <th>Country</th> <th>Total Hours</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td> <img src=". $row['PRank'] . "> </td>"; echo "<td>" . $row['IDPilot'] . "</td>"; echo "<td>" . $row['FullName'] . "</td>"; echo "<td><img src=". $row['Country'] ."></td>"; echo "<td>" . $row['flight'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> and this is the link of a visual display of the code http://www.dutch-global-virtual-airlines.nl/viewpage.php?page_id=21 Thanks for the help Vangelis Boulasikis Link to comment https://forums.phpfreaks.com/topic/164639-sum-of-time/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.