I first would like to thank obsidian for helping me to get the alternating row colors!
What I am trying to do
Right now my page looks like this:
http://www.supermandatabase.com/arb/row1.gif
Where it says DIVISION I would like it to be populated from a a MySQL Column to be the name of the Vehicle" instead. It would look as such:
http://www.supermandatabase.com/arb/row2.gif
Further details. In MySQL table I have a column named div (Division) and I would like to fetch "Acura" and use it as a table title. But only once. Since there are numerous Acura I only want it listed the single time with all the Acuras listed below that title (see second picture). Once it is done with Acura it will move to the next vehicle and use that as a title (see second pic).
Here is the code I am using to generate my page now (see picture one):
<?php
//Connect to the Database via the Include File!
require ('get_connected.inc');
// Begin your table outside of the array
echo "<table width='100%' border='0' cellpadding='1' cellspacing='0'>
<tr>
<td><b>DIVISION</b></td>
<td><b>DISPLACEMENT</b></td> //<----THIS IS WHERE I WAS THE MySQL TITLE
<td><b>FUEL</b></td>
<td><b>CLASS</b></td>
<td><b>EMISSION STD</b></td>
<td><b>TEST GROUP</b></td>
<td><b>EO NUMBER</b></td>
</tr>";
// Perform an statndard SQL query:
$res = mysql_query("SELECT sub_model, disp, fuel, veh_class, arb_std, test_group, eo FROM vlist_2007 ORDER BY division ASC") or die (mysql_error());
// Assuming $res holds the results from your query:
$class = 'even';
while ($row = mysql_fetch_assoc($res)) {
$class = $class == 'even' ? 'odd' : 'even';
echo "<tr class=\"$class\">\n";
echo "<td>$row[sub_model]</td>\n";
echo "<td>$row[disp]</td>\n";
echo "<td>$row[fuel]</td>\n";
echo "<td>$row[veh_class]</td>\n";
echo "<td>$row[arb_std]</td>\n";
echo "<td>$row[test_group]</td>\n";
echo "<td>$row[eo]</td>\n";
echo "</tr>\n";
}
?>
I was able to get the DIVISION replaced by a value in the title header... but I need to break it in groups as seen in Photo 2.