Parse error: parse error, unexpected T_VARIABLE

Discussion in 'PHP' started by oskare100, Jan 3, 2007.

  1. #1
    Hello,
    I get the error Parse error: parse error, unexpected T_VARIABLE about this part of my script;
    $sql5="INSERT INTO $login_logs_tbl (user_id, ip, logged_date, logged_timestamp) VALUES("$vuserid[0]", "$_SERVER['REMOTE_ADDR']", $date, $timestamp)";
    $result5=mysql_query($sql5);
    PHP:
    Can you see what's causing the error? I've tried but I can't figure out what...

    Best Regards
    Oskar
     
    oskare100, Jan 3, 2007 IP
  2. ZareMedia

    ZareMedia Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    $sql5="INSERT INTO $login_logs_tbl (user_id, ip, logged_date, logged_timestamp) VALUES('$vuserid[0]', '{$_SERVER['REMOTE_ADDR']}', $date, $timestamp)";
    $result5=mysql_query($sql5);
    
    PHP:
     
    ZareMedia, Jan 3, 2007 IP
  3. DXL

    DXL Peon

    Messages:
    380
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or, more like your way:
    $sql5="INSERT INTO $login_logs_tbl (user_id, ip, logged_date, logged_timestamp) VALUES(".$vuserid[0].", ".$_SERVER['REMOTE_ADDR'].", $date, $timestamp)";
    $result5=mysql_query($sql5);
    PHP:
     
    DXL, Jan 3, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The IP will need to have single quotes around it.. so basically the same but
    VALUES(".$vuserid[0].", '".$_SERVER['REMOTE_ADDR']."', $date, $timestamp)
    PHP:
     
    rodney88, Jan 3, 2007 IP
  5. DXL

    DXL Peon

    Messages:
    380
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Rodney, you're right, I didn't take a good look at it ;)
     
    DXL, Jan 3, 2007 IP
  6. wesker

    wesker Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I love to see how people help each other with codes, website coding and such things :)
     
    wesker, Jan 4, 2013 IP