By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,601 Members | 1,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,601 IT Pros & Developers. It's quick & easy.

parse error

P: n/a
I'm a newbie and I can't figure out what this error means:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in /home/easilyta/public_html/pub/user.php on line 190.

heres a snippet of the code:
if (!isset($_COOKIE['cookie'][id])) {
header("Location:
http://error.easilytaken.com/usererror.php?error=login");
exit;
}
188 mysql_connect("localhost", "username",
"password");
189 mysql_select_db("database");
190 $cookie_idfind = mysql_query("SELECT cookie_id
FROM master WHERE user='$_COOKIE['cookie'][id]'");
191 $cookie_id = mysql_fetch_array($cookie_idfind);
192 if($cookie_id[0] == $_COOKIE['cookie'][auth]){
//
//
print 'hello, world';

basically what this does is takes the cookie[id] (which is the user field in
the db) and cookie[auth] (which is cookie_id in the db) using $_COOKIE and
checks to see if the user has the right authorization number stored in their
computer. any ideas as to why i get this error? the manuals are getting me
nowhere...

Thanks,
Matt
Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Matt Schroeder" <wn*********@comcast.net> wrote in message news:<wi2Ta.116311$Ph3.14479@sccrnsc04>...
I'm a newbie and I can't figure out what this error means:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in /home/easilyta/public_html/pub/user.php on line 190.

heres a snippet of the code:
if (!isset($_COOKIE['cookie'][id])) {
header("Location:
http://error.easilytaken.com/usererror.php?error=login");
exit;
}
188 mysql_connect("localhost", "username",
"password");
189 mysql_select_db("database");
190 $cookie_idfind = mysql_query("SELECT cookie_id
FROM master WHERE user='$_COOKIE['cookie'][id]'");
Your problem is that this line contains two sets of single quotes, one
inside the other, and the start of the second quoted string is being
taken as the end of the first quoted string. I would suggest that you
change your code to the following:-

$id = $_COOKIE['cookie'][id];
.... WHERE user='$id'");

Does this make sense to you?

By the way, when you want to post a new message please select "post a
new message" and not "post a follow-up" as it appears as an answer to
a previous post instead of a new post. The fact that the topic is
similar makes no difference.

Tony Marston
http://www.tonymarston.net/
191 $cookie_id = mysql_fetch_array($cookie_idfind);
192 if($cookie_id[0] == $_COOKIE['cookie'][auth]){
//
//
print 'hello, world';

basically what this does is takes the cookie[id] (which is the user field in
the db) and cookie[auth] (which is cookie_id in the db) using $_COOKIE and
checks to see if the user has the right authorization number stored in their
computer. any ideas as to why i get this error? the manuals are getting me
nowhere...

Thanks,
Matt

Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.