I tried php to modify the function many times. I think the code is okay? The offer. php code is as follows:
Include ("inc/conn. php ");
// Modify the password
$ Act = $ _ GET ["act"];
$ Offer = $ _ POST ["offer"];
If ($ act = 'edit ')
{
$ Id = $ _ POST ["id"];
$ Url = $ _ SERVER ['http _ referer'];
$ SQL = "update td set offer = '$ offer' where id = '$ ID '";
Mysql_query ($ SQL );
Echo "script alert ('review successful! '); Window. location. href =' ". $ url." '; script ";
}
?>
The code on the homepage is as follows: Session_start ();
Include ("inc/conn. php ");
?>
Recruitment-job search-Shanghai Yafei Talent Network
Include ("top. php ");
?>
|
|
|
|
Enterprise Management Center |
Modify enterprise information |
Publish recruitment |
Recruitment Management |
View posting resumes |
Exit |
|
|
|
|
|
|
|
|
|
$ Userid = $ _ SESSION ["userid"]; $ SQL = "select * from company where userid = '$ userid '"; $ Query = mysql_query ($ SQL ); $ Rs = mysql_fetch_assoc ($ query ); $ Com_id = $ rs ["com_id"]; Mysql_free_result ($ query ); ?>
|
|
|
Reply to discussion (solution)
@ Mix up @ Zhao 4
The control named id is not displayed in your form.
@ Mix up @ Zhao 4
I only recommend that you learn to write logs and debug logs first.
@ Zhao 4 what should I do?
Okay! Even the C ++ experts like Zhao 4 have come to grab your job!
You have
$ Id = $ _ POST ["id"];
$ SQL = "update td set offer = '$ offer' where id = '$ ID '";
However, the form does not contain the nam = "id" control, so $ _ POST ["id"] does not exist at all.
The actual SQL command you run is update td set offer = '$ offer' where id =''
Generally, id is the primary key, and the primary key cannot be empty. So your SQL commands are not executed.
@ Xuzuning:
You have
Or
Is this a control?
No. how do I pass the value?
@ Xuzuning no wonder that I have read other people's code before. The modification is as follows, but it still cannot be modified. it is strange!
$ Userid = $ _ SESSION ["userid"];
$ SQL = "select * from company where userid = '$ userid '";
$ Query = mysql_query ($ SQL );
$ Rs = mysql_fetch_assoc ($ query );
$ Com_id = $ rs ["com_id"];
Mysql_free_result ($ query );
?>
@ Xuzuning off. The php code is as follows:
Include ("inc/conn. php ");
// Modify the password
$ Act = $ _ GET ["act"];
$ Offer = $ _ POST ["offer"];
If ($ act = 'edit ')
{
$ Id = $ _ POST ["id"];
$ Url = $ _ SERVER ['http _ referer'];
$ SQL = "update td set offer = '$ offer' where id = 'id '";
Mysql_query ($ SQL );
Echo "script alert ('review successful! '); Window. location. href =' ". $ url." '; script ";
}
?>
@ Xuzuning the warning window is successful again, that is, the value cannot be modified!
$ SQL = "update td set offer = '$ offer' where id = '$ ID '";
Echo $ SQL;
Mysql_query ($ SQL) or die (mysql_error ());
Print it out to see what the SQL is, whether the parameters are correct, and whether the execution is wrong.