How PHP modifies data in the database according to the specified ID
$query = mysql_query (' SELECT * from Wdksm ');
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 '
';
}
$sql = ' UPDATE wdksm SET
Rsshtime = \ '. $_post[' Test ']. '\'
WHERE id = \ '. $id. '\' ';
mysql_query ($sql);
?>
Reply to discussion (solution)
ID is the number do not add ' '?
Your UPDATE statement is not going to execute? Looks fine.
Update your table name set the column name to change = the value to change where id = the ID number you specified
If I follow the data listed above, point out the audit under each data, the data "audit" will be written to the current data, and now write the data are written by default to the bottom of the data inside the
That's how your form is created.
Echo ';
There is no value for ID
So the submitted data does not contain a unique identification ID
And the ID in your SQL instruction is the last ID when the list was generated, and of course it's not.
Besides, your SQL command's writing is weird, too.
It's better to write like this
$sql = "UPDATE wdksm SET rsshtime = ' $_post[test] ' WHERE id = ' $_post[id] '";
$sql = "UPDATE wdksm SET rsshtime = ' $_post[test] ' WHERE id = ' $_post[id] '";
This code is put in not even write, I need to choose an ID, and write the data into this ID, do not affect the data of other IDs
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 '
';
}
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 '
';
}
The elder brother upstairs, according to your line of code to add in also not AH