SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    modify user details

    Hi there, i was wondering if you can help with my little problem. I'm trying to get the user to modify his/her's own details. I'm able to display the whole table of users for the admin to modify but i can't get the user to display just his/her's own details. i'm new to php so i was wonderig if you can look at my code.

    Code:
    <?php 
    
    include('config.php');
    
    mysql_select_db("student_bay_co_", $connection);
    
    // query to get records 
     $query = "Select * from registered_members1 where id = '$id'";
        $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 
        echo "<table cellpadding=10 border=1>";
    	 echo "<th>Firstnames</th><th>Surname</th><th>Street address</th><th>City</th><th>Postcode</th><th>Phone number</th><th>Email</th><th>Username</th><th>Password</th></tr>";  
        while($row = mysql_fetch_array($result)) { 
            echo "<tr>"; 
        echo "<td>".$row["Firstnames"]."</td>"; 
        echo "<td>".$row["Surname"]."</td>"; 
    	echo "<td>".$row["Street_address"]."</td>"; 
    	echo "<td>".$row["City"]."</td>"; 
    	echo "<td>".$row["Postcode"]."</td>";
    	echo "<td>".$row["Phone_no"]."</td>";  
    	echo "<td>".$row["email"]."</td>";
    	echo "<td>".$row["Username"]."</td>";
    	echo "<td>".$row["password"]."</td>"; 
            echo "</tr>"; 
        } //End while
        echo "</table>"; 
        //End Else insertion successful
    //End else successful Amendment     
    
    ?>

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Code:
    $query = "Select * from registered_members1 where id = '$id'";
    Where does $id come from?

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it supposed to be from the user thats logged in

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    But how do you pass it to this script? Session? Query string?

  5. #5
    SitePoint Zealot FaridHadi's Avatar
    Join Date
    Nov 2008
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Currently $id seems to be an undefined variable. You need to set $id to the ID of the logged in user.


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
  •