Front End User(bloger) turn on and off his comments

you should do something like this

//For update a page when use costum template
$post = get_the_ID();

 $my_post = array(
  'ID'           => $post,
  'comment_status' => 'open' // closed
);

// Update the post into the database
wp_update_post( $my_post );

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