Error in WP Query. If variable is empty it is displaying previous post value

Reset the variables right before the end of the loop by inserting statements like $company_name="";. Since there’s no check to make sure the variable becomes empty if the post_meta is empty, it will keep the previous one stored in the variable.

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