How does php specify the ID and modify the data in this post? Finally, the code is edited by jixizo from 2014-10-1411: 59: 15. if you select the first ID, the data cannot be modified. Only the second ID can be used to change the data in the second ID, but the data in the second ID cannot be modified after the first submission. The data in the third ID is modified only after the second submission, 2. how to specify the ID in the fourth I php and modify the data in the three IDs?
This post was last edited by jixizo at 11:59:15
In this code, selecting the first ID cannot modify the data. Only the second ID can be used to change the data in the second ID, but the data in the second ID cannot be modified after the first submission. The data in the third ID is modified only after the second submission, the data in the second, third, and fourth IDs are modified. In the previous IDs, all data of other IDs will be modified except the first ID.
$ 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 'Title: '. $ row ["zhiwu"].'
';
Echo 'time not punched in: '. $ row ["wdktime"].'
';
Echo 'The reason for not logging in: '. $ row ["wdkyy"].'
';
Echo 'Department owner review: '. $ row ["bmshtime"]. '';
Echo 'approval from the personnel administration department/General Manager: '. $ 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 in the ID without affecting the data of other IDs
In the second ID, after the second submission
After the third ID is submitted
After the fourth ID is submitted
------ Solution ----------------------
$ 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 'Title: '. $ row ["zhiwu"].'
';
Echo 'time not punched in: '. $ row ["wdktime"].'
';
Echo 'The reason for not logging in: '. $ row ["wdkyy"].'
';
Echo 'Department owner review: '. $ row ["bmshtime"]. '';
Echo 'approval from the personnel administration department/General Manager: '. $ row ["rsshtime"].'
';
Echo '';
Echo'
';
}
If ($ _ POST ){
$ SQL = "UPDATE wdksm SET rsshtime = '$ _ POST [test] 'Where id =' $ _ POST [id] '";
Mysql_query ($ SQL );}
}