PHP cookie not set within AJAX call

Apparently I was missing the time() attribute.
So when adding this to the expire option in the setCookie function, the cookie is being set.

Code:

setcookie('user-zipcode', $zipcode, time() + MONTH_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
setcookie('delivery-today', $cookieVal, time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);

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