Show text only to the author of the article

I came to a conclusion !

if ($current_user->ID == $post->post_author) 

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