How does php specify the ID and modify the data in it?

Source: Internet
Author: User
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 );}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.