Jump to content

help help due today


newbie12345

Recommended Posts

im trying to update the user account but for some reason its not updating

can any one help me with my code.

 

this is my code

or is there another way i can accomplish this

 

i was getting a error

Notice: Undefined variable: users in C:\wamp\www\music website1\updateaccount.php on line 8

 

Notice: Undefined variable: users in C:\wamp\www\music website1\updateaccount.php on line 21

<?php

session_start();
include ('connect.php');

if (isset($_POST["submit"])){

$_SESSION['u_name']=$users;

      $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 = '$users'");																																											

$rest = mysql_query($sql);

if ($rest){
echo "Your account have successfully been updated";
}ELSE{
     echo "There was an error updating ur account.<br>Please contact site admin";
       }
  
    }
  


?>

Link to comment
https://forums.phpfreaks.com/topic/201829-help-help-due-today/
Share on other sites

i solved that problem but its not updating in the database

 

<?php

session_start();
include ('connect.php');

if (isset($_POST["submit"])){

  $users= $_SESSION['u_name'];

      $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 = '$users'");																																											

$rest = mysql_query($sql);

if ($rest){
echo "Your account have successfully been updated";
}ELSE{
     echo "There was an error updating ur account.<br>Please contact site admin";
       }
  
    }
  


?>

Link to comment
https://forums.phpfreaks.com/topic/201829-help-help-due-today/#findComment-1058631
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.