Я хочу отобразить список категорий с соответствующими форумами, как и каждый классический форум. Heres an example.Показать категории форумов с форумами
Я нашел этот кусок кода в Интернете, он работает, но он не закрывает таблицы должным образом. Каждая категория должна иметь свою собственную таблицу, теперь она закрывает только с одним </table>
// Start the table here - outside the loop
echo '<table>';
// Here's how you track if you need the header
$lastCatID = -1;
// Now loop
foreach($query as $row)
{
// Only show cat header on condition
if ($lastCatID <> $row['cid']) {
echo '
<tr>
<th>' . $row['cat_name'] . '</th>
<th>Latest Reply</th>
<th>Topics</th>
<th>Posts</th>
</tr>';
// Note that you've shows this header so you don't show it again.
$lastCatID = $row['cid'];
}
// Now output the rest
echo '<tr>';
echo '<td width="55%">Link</a></td>';
echo '<td width="25%">User</td>';
echo '<td width="10%" align="center">23523</td>';
echo '<td width="10%" align="center">343235</td>';
echo '</tr>';
}
echo '</table>';