Get posts in a subcategory of a chosen parent

You should use get_posts or (even better) custom WP_Query to query posts.

You can use get_pages to do this, but get_pages can’t use category (or other taxonomies – just check it in WP sources) to filter results.

So your function should look like this:

function getPostsInCategory($category) {

    return get_posts(array(
        'post_status'   => 'publish',
        'category'      => $category, // e.g '3'  catgory is passed as 'cat' param of WP_Query, so it will display posts from children categories as well
        'posts_per_page'   => -1
    ));
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)