Cookie trouble in sql queries...

admin

Administrator
Staff member
Okay, I wasn't sure where to ask this, but it's been bothering me for awhile now, but I've always worked around it.

Basically, my question is: Why don't http_cookie_vars work in SQL queries?

I haven't ever been able to successfully poll a database using data from a cookie.

example code:
<?
$result = mysql($db, "SELECT emailaddress from users where (username='$HTTP_COOKIE_VARS[username]')");
?>
doesn't work.
Also, if I
$username = "$HTTP_COOKIE_VARS[username]";
then query with (username='$username') that doesn't work either.

Is there something I'm overlooking, or is there an easy way around this? I've learned PHP basically as one-step-at-a-time as possible, and this just baffles me.

Thanks,
-Issue9mm-
 
Back
Top