First comb the operation idea:
List all data
Select the data record you want to modify and enter the editable state.
Submit Modification Results Complete modification
Lists the data view.php in the database and adds a modify before each record so that the user can select the records they want to modify.
Copy CodeThe code is as follows:
$link =mysql_connect ("localhost", "root", "Administrator Password");
mysql_select_db ("Infosystem", $link);
$q = "SELECT * from Info";
mysql_query ("SET NAMES GB2312");
$rs = mysql_query ($q, $link);
echo "
"; echo "
Department Name |
Employee Name |
PC Name |
"; while ($row = Mysql_fetch_row ($rs)) echo "
Modify |
$row [1] |
$row [2] |
$row [3] |
$row [4] |
$row [5] |
$row [6] |
$row [7] |
$row [8] |
$row [9] |
$row [10] |
$row [11] |
$row [12] |
$row [13] |
"; echo "
";
?>
When the user clicks Modify, enter the editable state of the corresponding record modify_do.php:
Copy CodeThe code is as follows:
$link =mysql_connect ("localhost", "root", "Administrator Password");
if (! $link) {die ("error");}
echo "Connect MySQL successfully";
mysql_select_db ("Infosystem", $link);
$del _id=$_get["id"];
$q = "SELECT * from info where id= $del _id";
mysql_query ("SET NAMES GB2312"); Code Conversion
$rs = mysql_query ($q, $link);
if (! $rs) {die ("No results Displayed");}
?>
Finally, process the commit data modify_finish.php:
Copy CodeThe code is as follows:
$link =mysql_connect ("localhost", "root", "Administrator Password");
if (! $link) {die ("error");}
echo "Connect MySQL successfully";
mysql_select_db ("Infosystem", $link);
mysql_query ("SET NAMES GB2312");
$rs = mysql_query ($q, $link);
$row = Mysql_fetch_object ($RS);
$exec = "Update info set ename= '". $_post[' ename ']. "' Where id= '. $_post[' id ']." "; Modify the data and add the last update time
echo "modified successfully!";
Mysql_close ($link); To close a data set
?>
Author: Sunec
Original download: Cenus Blog
All rights reserved. The author and original source and this statement must be indicated in the form of a link in the reprint.
http://www.bkjia.com/PHPjc/319134.html www.bkjia.com true http://www.bkjia.com/PHPjc/319134.html techarticle first comb The operation idea: List all data selection needs to modify the data record, enter the editable state. Submit modification Results Complete modification first lists data in the database view ....