How does PHP specify the ID and modify the data inside
This post was last edited by Jixizo on 2014-10-14 11:59:15
This code, select the first ID can not modify the data. Only the second ID can be changed in the second ID of the data, but the first pass is not modified, the second commit will be modified, but in the third ID there modified the data, the second to third ID in the data, in the fourth ID inside the change data, the second, third, fourth ID inside the data will be modified. And then in the previous several IDs, except the first ID, the data of the other IDs will be modified
$query = mysql_query ("SELECT * from ' wdksm ' ORDER by ' id ' DESC");
$i = 0;
while ($row = Mysql_fetch_assoc ($query))
{{
$id [$i]= $row [' id '];
Echo ' Date: '. $row ["Time"]. " ;
Echo ' department: '. $row ["Bumen"]. " ;
Echo ' name: '. $row ["name"]. " ;
Echo ' duties: '. $row ["Zhiwu"]. '
';
Echo ' No Clock out time: '. $row ["Wdktime"]. '
';
Echo ' not clocked out reason: '. $row ["Wdkyy"]. '
';
Echo ' Department Responsible person audits: '. $row ["Bmshtime"]. " ;
Echo ' Personnel Administration department/General manager approves: '. $row ["Rsshtime"]. '
';
}
Echo ';
Echo '
';
$i = $i + 1;
for ($x =0; $x <= $i; $x + +)
{
$sql = ' UPDATE wdksm SET rsshtime = \ '. $_post[' Test '] . ' WHERE id = \ '. $id [$i]. '\' ';
mysql_query ($sql);}
}
?>
How to select the ID and modify the data within its ID without affecting the data of other IDs
In the second ID, after the second commit
After a third ID is submitted
After a fourth ID is submitted
------to solve the idea----------------------
$query = mysql_query ("SELECT * from ' wdksm ' ORDER by ' id ' DESC");
while ($row = Mysql_fetch_assoc ($query)) {
$id = $row [' id '];
Echo ' Date: '. $row ["Time"]. " ;
Echo ' department: '. $row ["Bumen"]. " ;
Echo ' name: '. $row ["name"]. " ;
Echo ' duties: '. $row ["Zhiwu"]. '
';
Echo ' No Clock out time: '. $row ["Wdktime"]. '
';
Echo ' not clocked out reason: '. $row ["Wdkyy"]. '
';
Echo ' Department Responsible person audits: '. $row ["Bmshtime"]. " ;
Echo ' Personnel Administration department/General manager approves: '. $row ["Rsshtime"]. '
';
Echo ';
Echo '
';
}
if ($_post) {
$sql = "UPDATE wdksm SET rsshtime = ' $_post[test] ' WHERE id = ' $_post[id] '";
mysql_query ($sql);}
}