Comparing permalink to url

You need to be using get_sub_field(), not the_sub_field() to set $company. the_sub_field() has no return, it just echos the value, whereas get_sub_field() returns the value (but does not echo it).

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