I pass the a.php page through the URL to the b.php page passed two parameters, and through the b.php page to the MySQL database to write the two parameters passed, why add two identical records in the database, but if you do not pass parameters to write a day record, instead of passing a parameter will be written to two identical records, which is written The code of the Record:
This problem has been a day, looking at the Great God Guide
Reply to discussion (solution)
Didn't you say it was done?
Follow your SQL command string
$sql = "INSERT into User_action (user_id, relation_id, Concern_time) VALUES ({$_get[' user_id '}, {$_get[' relation_id '}}, Now ()) ";
When parameters are not passed, the actual execution is
INSERT into User_action (user_id, relation_id, Concern_time) VALUES (,, now ())
This is the wrong instruction, there is no data to insert
But you said, "If you write a record without passing arguments," it's obvious that this record was inserted somewhere else.
Your code is more than that, it may be affected by other places.
Didn't you say it was done?
Follow your SQL command string
$sql = "INSERT into User_action (user_id, relation_id, Concern_time) VALUES ({$_get[' user_id '}, {$_get[' relation_id '}}, Now ()) ";
When parameters are not passed, the actual execution is
INSERT into User_action (user_id, relation_id, Concern_time) VALUES (,, now ())
This is the wrong instruction, there is no data to insert
But you said, "If you write a record without passing arguments," it's obvious that this record was inserted somewhere else.
It is because two data is inserted after passing the parameter, so one is used for testing! Before very few probabilities will be inserted correctly, so it should be a parameter problem
Didn't you say it was done?
Follow your SQL command string
$sql = "INSERT into User_action (user_id, relation_id, Concern_time) VALUES ({$_get[' user_id '}, {$_get[' relation_id '}}, Now ()) ";
When parameters are not passed, the actual execution is
INSERT into User_action (user_id, relation_id, Concern_time) VALUES (,, now ())
This is the wrong instruction, there is no data to insert
But you said, "If you write a record without passing arguments," it's obvious that this record was inserted somewhere else.
His problem feeling is that the page jumps when the question. It may not be the only part of the code he describes, all of his code may be executed at the time of the click to perform other operations inserted into the database, can add a parameter, identification is through this page (this click operation) to pass the insertion value, that is, MySQL user_id, relation_id, Concern_time Add a field s_url and then insert the value into it to see if the value of S_url in the two record is the same
I passed two parameters to the b.php page via a URL via the a.php page and wrote these two parameters to the MySQL database via the b.php page
Call b.php first to see if two records are inserted.
If b.php is normal, the problem is a.php and vice versa.
Only the code you provide will not insert two records because there is only one insert statement.
Landlord you see from a page to B page of the request header is not referer information, this may cause duplicate send the statement problem. Try to enter the B page address directly in the address bar with the parameters to see if the same data will be written