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.


<?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     

?>

$query = "Select * from registered_members1 where id = '[B][COLOR="Red"]$id[/COLOR][/B]'";

Where does $id come from?

it supposed to be from the user thats logged in

But how do you pass it to this script? Session? Query string?

Currently $id seems to be an undefined variable. You need to set $id to the ID of the logged in user.