1

我有一个表格,其中包含有关心肺复苏术、急救等课程的信息……我想将此信息分类并显示到每个课程类型的表格中。所以所有的心肺复苏术课程都会放在一张桌子上,然后是一张用于急救课程的新桌子,等等......

下面的代码当前将每个类放入它自己的表中......如果可能的话,我需要按类名将它们组合在一起。

提前感谢您的帮助。斯科特

<?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>";
?>
4

0 回答 0