Hide button based on PHP result

You can use get_post_status(ID) to check to see if the post is published. You’ll need to pull the post ID (through WP Query/loop/etc)

if (get_post_status( $ID ) == "publish"){
    #Show Published Button
} else {
    #Show Not Published Button
} 

Get Post Status in the Codex

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