parse error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt Schroeder

    parse error

    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($_COOKI E['cookie'][id])) {
    header("Locatio n:
    http://error.easilytak en.com/usererror.php?e rror=login");
    exit;
    }
    188 mysql_connect(" localhost", "username",
    "password") ;
    189 mysql_select_db ("database") ;
    190 $cookie_idfind = mysql_query("SE LECT cookie_id
    FROM master WHERE user='$_COOKIE['cookie'][id]'");
    191 $cookie_id = mysql_fetch_arr ay($cookie_idfi nd);
    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


  • Tony Marston

    #2
    Re: parse error

    "Matt Schroeder" <wnawombat41@co mcast.net> wrote in message news:<wi2Ta.116 311$Ph3.14479@s ccrnsc04>...[color=blue]
    > 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($_COOKI E['cookie'][id])) {
    > header("Locatio n:
    > http://error.easilytak en.com/usererror.php?e rror=login");
    > exit;
    > }
    > 188 mysql_connect(" localhost", "username",
    > "password") ;
    > 189 mysql_select_db ("database") ;
    > 190 $cookie_idfind = mysql_query("SE LECT cookie_id
    > FROM master WHERE user='$_COOKIE['cookie'][id]'");[/color]

    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
    This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL

    [color=blue]
    > 191 $cookie_id = mysql_fetch_arr ay($cookie_idfi nd);
    > 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[/color]

    Comment

    Working...