Hi -
I am a little stumped on a problem with filling a table with mysql data, with respect to the table layout.
My table is to take a simple form:
<form>
<table border=1>
<tr>
<td><B> header 1<B>
<br>
<select multiple>
<option> subhead 1.1 </option>
<option> subhead 1.2 </option>
<option> subhead 1.3 </option>
</br>
</td>
<td><B> header 2<B>
<br>
<select multiple>
<option> subhead 2.1 </option>
<option> subhead 2.2 </option>
<option> subhead 2.3 </option>
</br>
</td>
</tr>
</table>
</form>
where header information comes from mysql_query($header, $db) query, and subheader information comes from a mysql_query($subheader, $db) query.
I've had no problem (!) doing this, but my problem is that I have 20 header entries (and rising) - thus my table is 20 cells wide. What I would like to have is the parser to return the first 5 rows, then insert a <tr> print rows 6-10 etc.
I guess I have to use the limit function in the first table query (for the header information), but am totally lost as to where to insert it. The relevent exert from my code, if someone could follow it and help....
echo ("<form>");
echo ("<table><tr>");
while ($dept =mysql_fetch_row($dept_query)) {
$query = ("SELECT cat_id, cat_name, dept_id FROM categories WHERE dept_id='$dept[0]' ORDER BY cat_id");
$cat_query= mysql_query($query, $dbconnect);
if (!$cat_query) {
mysql_error();
exit();
}
echo ("<td valign=TOP align=center><b>".$dept[1]."</b>");
echo ("<br>");
echo ("<select size=10 multiple name=\"class_id\">");
while ($cat=mysql_fetch_row($cat_query)) {
echo ("<option value=\"$cat[2].$cat[0]\">$cat[1]");
}
echo ("</option>");
echo ("</td>");
}
echo ("</tr></table>");