3. Update
<body>
<title>
Update
</title>
?
The beginning of the PHP program
$db = mysql_connect ("localhost", "root");
mysql_select_db ("MySite", $db);
if (! $id)
{
$result = mysql_query ("SELECT * from user", $db);
if ($myrow = mysql_fetch_array ($result))
{
printf ("
do {
printf ("%s<a href="%s?id=%s ">%s </a><br>\n",
$myrow ["id"], $PATH _info, $myrow ["id"], $myrow ["name"]);
}
while ($myrow = Mysql_fetch_array ($result));
}
Else
{
echo "I'm sorry!" No records in the database ";
}
}
Else
{
if ($submit)
{
$sql = "UPDATE user SET name= ' $name ', city= ' $city ',
Address= ' $address ', email= ' $email ' WHERE id= $id ';
$result = mysql_query ($sql);
echo "Thank you!" Data change complete \ n ";
}
Else
{
$sql = "SELECT * from user WHERE id= $id";
$result = mysql_query ($sql);
$myrow = Mysql_fetch_array ($result);
The following is not part of PHP
?>
<H2 align=left> Please make changes to the user's information:<form method= "POST" action= " echo $PATH _info?> ">
<input type=hidden name= "id"
Value= "<?php echo $myrow [" id "]?>" >
Name: <input type= "Text" Name= "the" "Value=" <?php
echo $myrow ["name]?>" ><br>
Cities: <input type= "Text" name= "City" value= "<?php Echo
$myrow ["City"]?> "><br>
Address: <input type= "Text" name= "Addresses" value= "<?php Echo
$myrow ["Address"]?> "><br>
E-mail: <input type= "Text" name= "email" value= "<?php Echo
$myrow ["Email"]?> "><br>
<input type= "Submit" name= "submit" value= "Revised completed" >
</form>
?
The end of PHP
65:}
}
?>
</body>