I'd suggest that you look into separating your HTML and PHP first. If you build some template html files to hold your information you'll save yourself a lot of typing.
So what you would do is generate an html file that holds the HTML for each of your rows. You would use some kind of identifiable NON-HTML text to mark the places you want to change (I like #CHANGE_THIS# style items). Then for each of your rows you'd change the identifier into to proper value.
Below I assume that there are 2 HTML files header.html, and row.html. I'm also assuming that you have a field called category that groups your cars, since from looking at your page I can't use any of the fields that you currently display.
$header_array = file("header.html");
$row_array = file("row.html");
$header = implode("", $header_array);
$row = implode("", $row_array);
$result = mysql_query("SELECT *
FROM inventory
WHERE Sold = '0'
ORDER BY Category, Year DESC, Miles ASC" , $db);
$category = "";
while ($myrow = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($category != $myrow['Category']) {
$category = $myrow['Category']
print preg_replace('#CATEGORY#', $category, $header);
}
$trow = preg_replace("#YEAR#", $myrow['Year'] , $row);
$trow = preg_replace("#MILES#", $myrow['Miles'] , $trow);
$trow = preg_replace("#MODEL#", $myrow['Model'] , $trow);
$trow = preg_replace("#PRICE#", $myrow['Price'] , $trow);
$trow = preg_replace("#EXT_COLOR#", $myrow['Exterior_Color'] , $trow);
$trow = preg_replace("#STOCK_NUM#", $myrow['Stock_Number'] , $trow);
print $trow;
}
That is the basics of doing what you want and cleaning up your code a bit. For grouping you need something in your table that will do the job, I used the fictional category. Then you can set a variable to null and check if it matches the current category for the row you are trying to display, if it doesn't reset category and print our your header.