Program start $db = mysql_connect ("localhost", "root"); mysql_select_db ("study", $db); Determine if the file is modified if ($submit) { $sql = "UPDATE wenzhang SET timu= $timu, zuozhe= $zuozhe, laiyuan= $laiyuan, textt= $textt WHERE id= $id ";
Issuing SQL commands to the database
$result = mysql_query ($sql); Article generation $t = Date ("y-m-d h:i:s"); $muoban 1 = fopen ("Muoban1.txt", "R"); $muoban 2 = fopen ("Muoban2.txt", "R"); $muoban 3 = fopen ("Muoban3.txt", "R"); $qita = "
Author: $zuozhe Source: $laiyuan Date: $t
|
"; $muoban 4=fread ($muoban 1,1000); $muoban 5=fread ($muoban 2,1000); $muoban 6=fread ($muoban 3,1000); Fclose ($muoban 1); Fclose ($muoban 2); Fclose ($muoban 3); $main = "$muoban 4 $timu $qita $muoban 5 $textt $muoban 6"; Article generation $TTT = ". html"; $n = $id. $ttt; $f = fopen ($n, "w"); Fwrite ($f, $main); Fclose ($f);
echo "Record modified successfully!"";
} Do we enter edit modify state if ($id) { We are editing the modified state, because some select a record
$sql = "SELECT * from Wenzhang WHERE id= $id"; $result = mysql_query ($sql); $myrow = Mysql_fetch_array ($result); $id = $myrow ["id"]; $timu = $myrow ["Timu"]; $zuozhe = $myrow ["Zuozhe"]; $laiyuan = $myrow ["Laiyuan"]; $TEXTT = $myrow ["Textt"]; Display ID for users to edit and modify
$fom 1 = ""; echo $FOM 1; } if (! $id) {
If the status is not modified, the employee list is displayed
$result = mysql_query ("SELECT * from Wenzhang", $db); printf ("
");
while ($myrow = Mysql_fetch_array ($result)) {
printf ("
- %s N ",
$myrow ["id"], $myrow ["Timu"]);printf ("(modified)
", $PATH _info, $myrow [" id "]);
} printf ("
"); } End of program ?>
|