my basic php code producing unexpected results

Maybe you meant:

if($current_user->ID == $attachment->post_author) echo " Matched!! ";

PS: By unexpected results I think you are referring to the ‘DISEASES OF THE PENIS’ part… right?

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