obtain the author id given the post id

$b = get_post( $a);
// post_author already contain author ID. 
//So you can assign author's ID to $c same as to $d
$c = $d = $b->post_author;

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