我的表包含有关CPR,First Aid等类的信息...我想将这些信息排序并显示在每个类类型的表中。因此,所有的CPR课程都会在一张桌子上,然后是急救课程的新表格等等......
下面的代码目前将每个类放入它自己的表中......如果可能的话,我需要通过className将它们组合在一起。
提前感谢您的帮助。 斯科特
<?php
$result = mysql_query("SELECT * FROM providerClasses WHERE clientId = '$clientId' ORDER BY className");
$i = 0; // Start count for BG color
while($row = mysql_fetch_array($result)) {
echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" class=\"gridTable\" width=\"975\" style=\"margin-bottom:100px;\">";
echo "<tr class=\"gridHeader\">";
echo "<td width=\"88\" class=\"grid-header-cell\">Date</td>";
echo "<td width=\"161\" class=\"grid-header-cell\">Time</td>";
echo "<td width=\"143\" class=\"grid-header-cell\">Instructor</td>";
echo "<td width=\"179\" class=\"grid-header-cell\">Location</td>";
echo "<td width=\"8\" class=\"grid-header-cell\">Price</td>";
echo "<td width=\"210\" class=\"grid-header-cell\">Class Name</td>";
echo "</tr>";
$className = "$row[className]";
$date = "$row[date]";
$time = "$row[time]";
$instructor = "$row[instructor]";
$location = "$row[location]";
$price = "$row[price]";
$comments = "$row[comments]";
$i++;
// Determine background color of row
if ( $i & 1 ) { $style = "GridRow-Even"; //even
}
else { $style = "GridRow-Odd"; //odd
}
echo "<tr class=\"$style\">";
echo "<td> $date</td>";
echo "<td> $time</td>";
echo "<td> $instructor</td>";
echo "<td> $location</td>";
echo "<td> $price</td>";
echo "<td> $className</td>";
echo "</tr>";
} // end while
echo "</table>";
?>