How to create shortcode to show the 2 latest posts

Add wp_reset_postdata() after your while loop:

        endwhile;
    wp_reset_postdata();
endif;

This will ensure that, after your shortcode runs, the actual current post is restored, so that any template tags display the right data.

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