Results 1 to 1 of 1

Thread: Profile Editing.

  1. #1
    Join Date
    Jun 2017
    Location
    Bengaluru, Karnataka, India
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Profile Editing.

    PHP Code:
    <?php
             
    if(isset($_POST["update"]))
             {
                
    //echo'<pre>';print_r($_POST);exit();
                //$user_name =$_POST["name"];
                
    $conn mysqli_connect("localhost""root""""videos") or die("Connection to Server failed!" mysqli_error());
                
    $query mysqli_query("SELECT * from users WHERE Id='$_POST[Id]'");
                
    $username $_Get[$query('Username')];
                
    $email $_Get[$query('Email')];
                
    $employee $_Get[$query('EmployeeID')];
                
    $designation $_Get[$query('Designation')];
                
    $password $_Get[$query('Password')];
                
    $id =$_Get['Id'];
                
    // Connect to server and select database.
                // $conn = mysqli_connect("localhost", "root", "", "videos") or die("Connection to Server failed!" . mysqli_error());
                // $selet = mysqli_select_db("first_db", "root", "") or die("Cannot connect to database");
                 //echo $query;exit(); 
                
    $result mysqli_query($query);
                
    $rows mysqli_num_rows($result);
                
    //     //echo'USER EXIST'; 
                
    if ($rows==$id)
                { 
                    while(
    $rs mysqli_fetch_array($result))
                    {
                         
    $username $rs["Username"]; 
                         
    $email $rs["Email"];
                         
    $employee =$rs["EmployeeID"];
                         
    $designation=$rs["Designation"];
                         
    $password=$rs["Password"];
                    }
                }
                 
    $query mysqli_query($conn"UPDATE users SET Username='$name', Email='$email', EmployeeID='$employee', Designation='$designation', Password='$password' WHERE Id='$id'");
                
    $result mysqli_query($query); 
                 if(
    $result==false)
                {
                        die(
    mysqli_error()); 
                }
                
    header("Location: settings.php"); 
                return 
    mysqli_affected_rows();
                
    //echo'<pre>';print_r($result);exit();
                
    exit();
        }
    ?>
    This is my php code for profile editing of users by admin. I have added "value" element in expected fields my html form. But still I am unable to fetch the data into those form fields. for example, I am getting following error in expected field:

    Code:
    <br /><b>Notice</b>: Undefined variable: username in <b>C:\xampp\htdocs\VS\edit.php</b> on line <b>120</b><br />
    I am fresher for php. I hope that I will get solution immidiately from experts in this forum.

    Thank You,
    Last edited by jscheuer1; 06-16-2017 at 03:31 PM. Reason: format code

Similar Threads

  1. php: change their profile settings
    By anvienonline2 in forum PHP
    Replies: 3
    Last Post: 09-02-2014, 05:07 PM
  2. Resolved how to add friends to my profile?
    By ajfmrf in forum The lounge
    Replies: 1
    Last Post: 12-07-2012, 03:05 AM
  3. Profile page help.
    By Jeffreyv1987 in forum PHP
    Replies: 2
    Last Post: 10-05-2010, 02:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •