Jump to content

[SOLVED] list from most recent?


elmas156

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.