+ 1

Importing data to many sql tables with one HTML form and one php file

Hallo. I’m trying to insert user input from a single HTML form with php in to many (3) MySQL tables. UPDATE: I checked it and it fills the data only in the first table. No information comes in table 2 and 3. Any idea how to make it work? Thank you https://code.sololearn.com/wq2JYW6t14vF/?ref=app

13th Dec 2018, 9:30 PM
pap
pap - avatar
5 Réponses
+ 2
What is the structure of your tables ? Comment your code by section to debug and find your error. PS : In second insert operation you use the same table name. (Table_Admin) I think that you should do with update statement
14th Dec 2018, 7:28 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
+ 1
Prokopios Poulimenos i correct the table name in the second insert. these are test tables each with 2 or 3 collumns. i’m not sure if wrote the conn statemnt right and if i must end each statment separatelly. thanks
14th Dec 2018, 8:02 AM
pap
pap - avatar
+ 1
I am sorry I dont have also somewhere to test it. I think that admin is not needed in the connection : So, modify the line $conn = new mysqli ($host, $db_username, $db_password, $db, $db_table_admin); to $conn = new mysqli($host , $db_username , $db_password , $db );
14th Dec 2018, 8:54 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar
+ 1
Prokopios Poulimenos you are right. the name of the table is not needed (EDITED). do i need a connection to each table or i should vonnect them separatelly? i mean so for each table: $conn = new mysqli ($host, $db_username, $db_password, $db, $db_table_admin); or so folr all of them at once: $conn = new mysqli ($host, $db_username, $db_password, $db, $db_table_admin, $db_table_pre; $db_table_post);
14th Dec 2018, 9:18 AM
pap
pap - avatar
+ 1
Prokopios Poulimenos , i tied the code and it only sends the data in the first table. the other two received no data. any idea how i can run multiple prepared statements? thanks
15th Dec 2018, 3:52 AM
pap
pap - avatar