Well, I need help on this. I have 2 "categories" on the MySQL database and I want to show all of them, but the code I made only show 1 category (The first result in the database). Could you help me? The code I am using is right below.
PHP:
/*
* Assembles the entire board.
* Returns a $string.
*/
public function makeForum() {
global $CT, $o;
$CT->mysqli->query("SELECT * FROM {prefix}forum_category ORDER BY place ASC");
$return = '';
$param = array('%category_name%', '%category_description%', '%category_forums%', '%board_table_forum%', '%board_table_latest_thread%');
$template = $o->template->addTpl('category');
if( $CT->mysqli->num_rows !== 0 ) {
while( $arr = $CT->mysqli->fetch('query') )
{
$values = array($arr['name'], $arr['description'], $this->makenodes($arr['id']), BOARD_TABLE_FORUM, BOARD_TABLE_LATEST_THREAD);
$return .= str_replace($param, $values, $template);
}
return $return;
} else {
return '<div align="center"><h1>Forum is not ready at the moment!</h1></div>';
}
}
/*
* Assembling the nodes for a category.
*/
private function makeNodes($id) {
global $CT;
$CT->mysqli->query("SELECT * FROM {prefix}forum_nodes WHERE category = '$id' ORDER BY place ASC");
$return = '';
if( $CT->mysqli->num_rows !== 0 ) {
while( $arr = $CT->mysqli->fetch('query') )
{
$return .= '<tr>
<td>' . $arr['name'] . '<br /><small>' . $arr['description'] . '</small></td>
<td>By me!</td>
</tr>';
}
}
return $return;
}