Why setcookie function redirecting to home page in wordpress?

Please use the Domain & other parameters also in cookie…

setcookie('cookie_name', cookie_val, time()+3600, COOKIEPATH, COOKIE_DOMAIN, false);

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