How PHP Specifies the ID and modifies the data inside

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

    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.