Here is a part of a script where a member of this site was wanting to be able to edit content of users in an admin area of their site. In another script they select the user that they want to edit new content of and this script shows the current content then saves the changes using two seperate queries.
<?php
//session_start();
//Now you can use the session data
$_SESSION['news'] = $_POST['Newnews'];
$id = $_POST['cid'];
//echo "$id is the id selected";
$news = $_POST['Newnews'];
$connect =mysql_connect('localhost','root')
or die("Couldn't connect to server".mysql_error());
$db = mysql_select_db('angel_test')
or die("Couldn't select the database".mysql_error());
$query = "UPDATE job_story SET news = '$news' WHERE id = '$id' ";
//echo "$query <br>";
$result = mysql_query($query);
$query2 = "SELECT news,name FROM job_story WHERE news = '$news' AND id = '$id'";
$result2 = mysql_query($query2);
echo "<textarea name='texttest'cols=60 rows=6>";
while($row=mysql_fetch_assoc($result2)){
echo $row['news']."</textarea><br /><br />";
echo "The above is what was entered into the database for {$row['name']}";
}
echo"<br /><br />To edit another user <a href='edituser.php'>Click here!</a>";
echo"<br />To go to the home page then <a href='index.php'>Click here!</a>";
?>