Php: how to modify the field content in a table

Source: Internet
Author: User
How does php modify the field content in the table: the content in this field, but cannot be written. & lt ;? Php & nbsp; $ query & nbsp; mysql_query (SELECT & nbsp; * & nbsp; FROM & nbsp; wdksm & nbsp;); how does whil php modify the field content in the table?
For Cainiao, how does one modify the content of a field without changing other fields? now I want to modify the content in the 'Department owner review: 'field, but it cannot be written.
While ($ row = mysql_fetch_assoc ($ query ))
{
Echo 'date: '. $ row [time]. '';
Echo 'Department: '. $ row [bumen]. '';
Echo 'name: '. $ row [name]. '';
Echo 'Title: '. $ row [zhiwu].'
';
Echo 'time not punched in: '. $ row [wdktime].'
';
Echo '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'
';
}
Echo '';
Mysql_query ('update wdksm SET
Bmshtime = \ ''. $ _ POST ['test']. '\'
WHERE time = \ ''. $ row [id]. '\'
');


?>
------ Solution ----------------------
If you want to connect to mysql, you can use the following code to analyze your source code:

$ Query = mysql_query ('select * FROM wdksm ');
While ($ row = mysql_fetch_assoc ($ query ))
{
$ Id = $ row ['id']; // The id number to be modified is not obtained. it should be obtained here.
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''; // The submit button is placed outside the form, causing the form to fail to be submitted
Echo'
';
}
Echo '';
/* Mysql_query ('update wdksm SET
Bmshtime = \ ''. $ _ POST ['test']. '\'
WHERE time = \ ''. $ row [id]. '\' // SQL statement with severe errors
');*/
// Correct SQL statement
$ SQL = 'update wdksm SET
Bmshtime = \ ''. $ _ POST ['test']. '\'
WHERE id = \ ''. $ id .'\'
';
Mysql_query ($ SQL );



The execution result is successfully modified 'Department owner Review '.

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.