Parse error: syntax error

Discussion in 'PHP' started by gspabla, Apr 18, 2009.

  1. #1
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/*******/public_html/******.com/register_confirm.php on line 9

    This is line no. 9:
    $update1 = mysql_query("update register set matriid=concat(prefix,id),age=$_SESSION['Age']")


    can u tell me what's wrong in this code
     
    gspabla, Apr 18, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    it should be this i guess

    $update1 = mysql_query("update register set matriid=concat(prefix,id),age=$_SESSION['Age']");

    php ends with ;
     
    Bohra, Apr 18, 2009 IP
  3. gspabla

    gspabla Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    still showing same error
     
    gspabla, Apr 18, 2009 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    post full code here
     
    Bohra, Apr 18, 2009 IP
  5. zelphics

    zelphics Active Member

    Messages:
    766
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    68
    #5
    can you post us lines 8 - 10, that might also help! :)
     
    zelphics, Apr 18, 2009 IP
  6. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #6
    $_SESSION['Age'] - you can't use this in your SQL query !

    Try this :
    $age = $_SESSION['Age'];
    $update1 = mysql_query("update register set matriid=concat(prefix,id),age='$age'");
    PHP:
    Another thing - what concat(prefix,id) stands for ?
     
    ActiveFrost, Apr 19, 2009 IP
  7. kishore415

    kishore415 Well-Known Member

    Messages:
    1,462
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    160
    #7
    This will fix your error..

    $update1 = mysql_query("update register set matriid=concat(prefix,id),age='".$_SESSION['Age']."'")

    Thanks
     
    kishore415, Apr 19, 2009 IP
  8. nayes84

    nayes84 Member

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #8
    or can be
    
    $update1 = mysql_query("update register set matriid=concat(prefix,id),age='$_SESSION[Age]'");
    
    PHP:
    :D
     
    nayes84, Apr 19, 2009 IP
  9. gspabla

    gspabla Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    thanx all for replying
    the workin code is
    $update1 = mysql_query("update register set matriid= concat(prefix,id), age= ".$_SESSION['Age'])
     
    gspabla, Apr 19, 2009 IP