elmas156 Posted September 17, 2008 Share Posted September 17, 2008 Hello, I'm building a website to help customers keep track of their vehicle service dates and mileage. I've built a page that will display this information but I want to list the information starting from the most recent service, which would also be the largest number of miles. How would I go about doing this? Any help would be appreciated. Here's the code that I have now: <?php $result2 = mysql_query("SELECT * FROM lastservice WHERE email = '$email' AND lp = '$lp'"); $s = mysql_num_rows($result2); while( $row2 = mysql_fetch_array($result2) ) { $date = $row2[ "date" ]; $mileage = $row2[ "mileage" ]; echo "<table width=\"200\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr>"; echo "<td width=\"120\" align=\"left\" valign=\"top\"><strong>Service Date:</strong></td>"; echo "<td width=\"80\" align=\"left\" valign=\"top\">$date</td>"; echo "</tr>"; echo "<tr>"; echo "<td width=\"120\" align=\"left\" valign=\"top\"><strong>Service Mileage: </strong></td>"; echo "<td width=\"80\">$mileage</td>"; echo "</tr>"; echo "</table>"; echo "<hr width=\"250\">"; } ?> Link to comment https://forums.phpfreaks.com/topic/124602-solved-list-from-most-recent/ Share on other sites More sharing options...
genericnumber1 Posted September 17, 2008 Share Posted September 17, 2008 SELECT * FROM lastservice WHERE email = '$email' AND lp = '$lp' ORDER BY mileage DESC Link to comment https://forums.phpfreaks.com/topic/124602-solved-list-from-most-recent/#findComment-643561 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.