Example #1
0
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $category = $row;
        $category['page_count'] = $page_count;
    }
} else {
    $category = null;
}
$page2 = $page - 1;
$page3 = $page + 1;
$result = $connection->query('SELECT * FROM topic WHERE category_id = ' . $connection->real_escape_string($_GET['id']) . ' ORDER BY id DESC LIMIT ' . $page2 * PAGE_LIMIT . ',' . $page * PAGE_LIMIT . ' ;') or die("error: " . $connection->error);
if ($result->num_rows > 0) {
    $rows = $result->num_rows;
    while ($row = $result->fetch_assoc()) {
        $topics[$row['id']] = $row;
        $topics[$row['id']]['preview'] = $bbcode->stripBBCodeTags(strlen($row['content']) > SMALL_DESC_LIMIT ? substr($row['content'], 0, SMALL_DESC_LIMIT - 3) . '...' : $row['content']);
        $topics[$row['id']]['last_updated'] = date('d/m/y G:i', strtotime($row['last_updated']));
        $result2 = $connection->query('SELECT * FROM users WHERE id = ' . $row['author_id']);
        if ($result2->num_rows > 0) {
            while ($row2 = $result2->fetch_assoc()) {
                $topics[$row['id']]['author_name'] = $row2['name'];
            }
        }
    }
} else {
    $topics = null;
}
$additional_cat_admin_buttons = array();
$additional_cat_admin_buttons = hook_filter('add_category_admin_buttons', $additional_cat_admin_buttons);
$additional_cat_user_buttons = array();
$additional_cat_user_buttons = hook_filter('add_category_user_buttons', $additional_cat_user_buttons);