Results 1 to 2 of 2

Thread: modify user details

  1. #1
    Join Date
    Oct 2010
    Posts
    11

    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
    Join Date
    Apr 2011
    Posts
    3

    hmm

    it looks like you are only pulling one record from the db? If so try using mysql_fetch_assoc() which will return a single associative array.

    <?php

    ....db query.....

    if(mysql_num_rows($result) > 0){

    $array = mysql_fetch_assoc($result);

    html.... <?php echo $array['firstnames'];?> ....html

    ..............

Similar Threads

  1. What to do now so that others can modify site later.
    By StudentTechy in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 21 Sep 2009, 10:34 PM
  2. Get the user input details and save
    By gihan in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 10 Jun 2007, 12:15 PM
  3. Get the User Details
    By gihan in forum General Questions
    Replies: 1
    Last Post: 10 Jun 2007, 01:18 AM

Posting Permissions

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