thisisafakeaccount12
Technical User
I have a small application that displays an HTML table in categories. The problem is I want a category header to be output each time the category changes. I have a numerical field in the database for the category.
I'm pretty dumb, so please be specific with any comments
i.e.
Category 1
cat1 info from db
more cat1 info from db
Category 2
cat2 info from db
more cat2 info from db
My work so far is as follows:
I was thinking that the headers would look like this:
Thanks
I'm pretty dumb, so please be specific with any comments
i.e.
Category 1
cat1 info from db
more cat1 info from db
Category 2
cat2 info from db
more cat2 info from db
My work so far is as follows:
Code:
$query = 'SELECT * FROM `opportunities` WHERE `category` = 1 ORDER BY `dateadded` DESC;';
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
echo "
<tr>
<td>$program</td>
<td>$description</td>
<td>$funder</td>
<td>$duedate</td>
<td>$nofavalue$guidevalue$applicationvalue</td>
</tr>\n";
}
?>
I was thinking that the headers would look like this:
Code:
<tr>
<td colspan="5">$category<a name="$category"></a></td>
</tr>
Thanks