Php writes data to multiple tables. how can I use php to write data simultaneously under the same field in multiple mysql tables?
Reply to discussion (solution)
Write the same fields in multiple tables at the same time
Obviously, this design is unreasonable.
Although relational databases have some redundancy, they are not like you.
Multiple SQL statements can be executed.
$ Username = $ _ POST ['username'];
$ Password = $ _ POST ['psd '];
$ Sex = $ _ POST ['Sex '];
$ Grade = $ _ POST ['Grad'];
$ Age = $ _ POST ['age'];
$ Height = $ _ POST ['height'];
$ Weight = $ _ POST ['weight'];
// Check form data
If (! Preg_match ('/^ [\ w \ x80-\ xff] {3, 15} $/', $ username )){
Exit ('error: the user name does not meet the requirements! Back ');
}
If (strlen ($ password) <6 ){
Exit ('error: Invalid password length! Back ');
}
Include ('Conn. php ');
$ SQL = "INSERT INTO user (username, password, sex, grade, age, height, weight) VALUES ('$ username',' $ password', '$ sex ', '$ grade', '$ age',' $ height', '$ weight ')";
Insert into module1 (username) VALUES ('$ username ');
Insert into module2 (username) VALUES ('$ username ');
Insert into module3 (username) VALUES ('$ username ');
Insert into module4 (username) VALUES ('$ username ');
Insert into module5 (username) VALUES ('$ username ');
If (mysql_query ($ SQL, $ conn ))
Exit ('registration successful! Click here to log on ');
Else
Echo 'Sorry, registration error! : ', Mysql_error (),'
';
Echo 'click here to return retry ';
?>
How can this be changed?
Your posting rate is too low
What is the same concept and the same concept at the same time?
I have already succeeded. thank you. I wrote too many new posts within a period of time, after weighted average .... This is what you see, so I think the posting methods and algorithms of the forum need to be improved.