nezbo Posted December 11, 2007 Share Posted December 11, 2007 Hi all I have a problem with an ORDER BY in my select statment. The proble i have is the if i order by time asc i get the 10:00 befor 9:00 and 00:00 before everthing and it should read 09:00 first shift of the day. 10:00 00:00 last sift of the day. Hope this makes sence. Neil Link to comment https://forums.phpfreaks.com/topic/81161-php-and-mysql-time-query/ Share on other sites More sharing options...
nezbo Posted December 11, 2007 Author Share Posted December 11, 2007 sorry i have noticed a error in my code eeek. but i still need the 00:00 to be displayed last. is this posible. This is my code. { $todaysDate = date('Y-m-d'); $getDatesFromRota = mysql_query("SELECT * FROM _fullrota WHERE fourWeekDate = '$todaysDate' ORDER BY fullStartTime") or die(mysql_error()); ?> <table align="center" border="1"><tr class="1"><td colspan="3"><strong><h3>Todays Staff Are!</h3></strong></td></tr> <tr class="2"><td><strong>Staff Name</strong></td><td><strong>Location</strong></td><td><strong>Start Time</strong></td></tr> <?php while ($getDatesFromRota2 = mysql_fetch_array($getDatesFromRota)) { if (($getDatesFromRota2['atcStaff']) == 0) { $theShiftPerson = $getDatesFromRota2['fullStaffName']; } else { $theShiftPerson = $getDatesFromRota2['atcStaff']; } $person = mysql_query("SELECT * FROM person WHERE CallID = $theShiftPerson") or die(mysql_error()); while ($person2 = mysql_fetch_array($person)) { $Person = $person2['FullName']; } $duty = mysql_query("SELECT * FROM _duty WHERE dutyID = '$getDatesFromRota2[fullDuty]'") or die(mysql_error()); while ($duty2 = mysql_fetch_array($duty)) { $duty3 = $duty2['dutyName']; } echo "<tr onmouseover=this.style.backgroundColor='#ebf5fc' onmouseout=this.style.backgroundColor='#FFFFFF'><td align=left>" . $Person . "</td><td>" . $duty3 . "</td><td>" . $getDatesFromRota2['fullStartTime'] . "</td></tr>"; } ?> </table> <?php } Link to comment https://forums.phpfreaks.com/topic/81161-php-and-mysql-time-query/#findComment-411812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.