[helP helP helP helP due today] uPdating user account

Discussion in 'PHP' started by newbie12345, May 14, 2010.

  1. #1
    im trying to update the user account
    but im getting a little Problem.

    im uPdating their account using the session from when they logged in

    this is the session i created when they logged in.
    
    $_SESSION['u_name']=$user;
    
    PHP:
    and im trying to uPdate their account
    this is my scriPt
    i was getting an error wen i ran it
    Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\music website1\updateaccount.php on line 21
    
    session_start();
    include ('connect.php');
    
    if (isset($_POST["submit"])){
    	
    	$_SESSION['u_name']=$user;
    
          $user  = $_POST['u_name'];
    	  $first  =$_POST['f_name'];
    	  $last  = $_POST['l_name'];
    	  $birth   = $_POST['DOB'];
    	  $sex        = $_POST['gender'];
    	  $addres    = $_POST['address'];
    	  $pass   = $_POST['pwd'];
    	  $conpass    = $_POST['pwd1'];
    	  $eaddress  =$_POST['e_address'];
    	  
    
    $sql= ("UPDATE user_accounts SET username = '$user', firstname = '$first', lastname = '$last', birthday = '$birth', gender = '$sex', address = '$addres', password = '$pass', confirm_password = '$conpass', email_address = '$eaddress' WHERE user_id = '$_SESSION['u_name']'");																																											
    
    mysql_query($sql);
    
    if mysql_query($sql){
    	echo "Your account have successfully been updated";
    }ELSE{
         echo "There was an error updating ur account.<br>Please contact site admin";
           }
      
        }
      
      }
    
    PHP:
     
    newbie12345, May 14, 2010 IP
  2. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Its because of the way you are including the session variable in the update line.

    $sql= ("UPDATE user_accounts SET username = '$user', firstname = '$first', lastname = '$last', birthday = '$birth', gender = '$sex', address = '$addres', password = '$pass', confirm_password = '$conpass', email_address = '$eaddress' WHERE user_id = '{$_SESSION['u_name']}'");
    PHP:
    You will also need to change this line as so;

    if (mysql_query($sql)){
    PHP:
    and you appear to have one too many closing braces at the end.
     
    lukeg32, May 15, 2010 IP