How to end this loop properly?

Let’s throw everything, but loop out:

if ($my_query->have_posts()) {

    // open container around all posts

    while ($my_query->have_posts()) :
        $my_query->the_post();

        // output for every post

    endwhile;

    // close containers around all posts
}

As you see:

  • output of posts goes inside while loop as usual;

  • opening larger containers is between checking if we have posts and while;

  • closing larger containers should be after endwhile, but still inside if block.

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