How can I create a shortcode from an html and php code written together

How can I create a shortcode from an html and php code written together

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