Re: Cookie, header, output problems
| From: | Chris Shiflett | Date: | Tue, 14 Jan 2003 15:29:57 +0000 |
| Subject: | Re: Cookie, header, output problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131567@lists.php.net to get a copy of this message | ||
--- "J. Alden Gillespy" <doggabow@jackloren.com> wrote:
> I'm creating an e-commerce website, and I just need
> clarification as to whether a MySQL query is
> considered as "browser output".
It is not. However, a MySQL error is indeed output. Make
sure your query is successful.
My suggestion would be to simplify your code. Test your
queries independently of setting cookies and redirecting.
You have too many potential cases for error as it is, and
that makes things difficult.
> mysql_query("select * from
$cart->user_table where
> username=\"$username\" and userpass=\"$userpass\"",
> $cart->dblink)
I'm not sure if it is just formatting or my eyes, but it
looks like you have backticks in your query. Also, you
should consider using single quotes around your values
rather than escaped double quotes.
> setcookie("jackloren_user", "$username:$userpass", time()
> + 2592000);
> header("Location: http://www.jackloren.com/");
You should test this combination separately. Depending on
several factors, your cookie may not be getting set due to
the Location header redirect. The combination works fine
with most modern Web agents, but it has been known to pose
problems for developers.
Chris