note 28468 rejected from function.setcookie by tix
| From: | tix@php.net | Date: | Tue, 14 Jan 2003 11:47:28 +0000 |
| Subject: | note 28468 rejected from function.setcookie by tix | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42118@lists.php.net to get a copy of this message | ||
I'm creating an e-commerce website, and I just need clarification as to whether a MySQL query
is considered as "browser output". I ask because I have the following code, but the
cookie isn't being set:
if (mysql_num_rows(mysql_query("select * from
$cart->user_table where
username=\"$username\" and userpass=\"$userpass\"", $cart->dblink)) !=
1) {
$errormsg = "Invalid username or password. Please try again.";
} else {
setcookie("jackloren_user", "$username:$userpass", time() + 2592000); //
expires in 30 days
}
The cookie is able to be set before the query, but not after. Is a MySQL query considered as that
dreaded browser output that messes up cookie creation? And if so, why? And finally, has anyone
found a way around this problem without hindering the functionality of the script?
Thanks.
Dogga