php - Sorting distinct results into different tables -
i have table contains information on classes cpr, first aid, etc...i sort , display information table each class type. of cpr classes in table new table first aid classes, etc...
the code below puts each class it's own table...i need group them classname if possible.
thanks in advance help. scott
<?php $result = mysql_query("select * providerclasses clientid = '$clientid' order classname"); $i = 0; // start count 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>"; ?>
Comments
Post a Comment