$product->ID in has_term() not working, but manually inputting the ID works, why?

$product->ID in has_term() not working, but manually inputting the ID works, why?

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