Exemplo n.º 1
0
function get_comments_of_cat($cat_id)
{
    global $config_vars, $db;
    // makes this to the first comment of content $content_id
    $sql = 'SELECT * FROM ' . $config_vars['table_prefix'] . 'cat_comments
		WHERE (owner_id = ' . $cat_id . ') and (parent_id = 0) ORDER BY creation_date';
    if (!($result = $db->sql_query($sql))) {
        error_report(SQL_ERROR, 'get_comments', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result)) {
        $com = new cat_comment();
        $com->generate_from_row($row);
        $com_array[] = $com;
    }
    return $com_array;
}