Get posts from current category?

function filter_where_older( $where="" ) {
    $date = get_the_time('Y-m-d H:i:s');
    $where .= " AND post_date < '$date'";
    return $where;
}

function filter_where_newer( $where="" ) {
    $date = get_the_time('Y-m-d H:i:s');
    $where .= " AND post_date > '$date'";
    return $where;
}

$category = get_the_category();
if(!empty($category)) {

    $cat_id = $category[0]->term_id;

    add_filter( 'posts_where', 'filter_where_older' );
    // retrieve older posts from current post
    $query = new WP_Query( "cat=$cat_id&order=ASC&posts_per_page=5" );
    remove_filter( 'posts_where', 'filter_where_older' );

    add_filter( 'posts_where', 'filter_where_newer' );
    // retrieve newer posts from current post
    $query = new WP_Query( "cat=$cat_id&posts_per_page=5" );
    remove_filter( 'posts_where', 'filter_where_newer' );

}

error code: 523