wpdb insert working in one function, but not another

This function was being made by an ajax call. The anchor link that made the call pointed to the same url. I changed the href to # and it now works perfectly.

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