Checking if looped item has a parent inside a shortcode

The WP_Post class has an attribute post_parent that you can use for this.

while ($q->have_posts()) {
      $q->the_post();
      $post = get_post();
      if (!empty($post->post_parent)) {
          // do something different
      }
}

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