salimalisalim Posted February 23, 2014 Share Posted February 23, 2014 Hi,I have a form, while submitting this i need to store the values into two different tables in a database,Some values will store in a table and others will store in a another table. How can i write it's query ?For Example,$sql="INSERT INTO table1 (field1, field2, field3,field4)VALUES('$_POST[column1]','$_POST[column2]','$_POST[column3]','$_POST[column4]')";$sql2="INSERT INTO table2 (field5, field6, field7,field8)VALUES('$_POST[column5]','$_POST[column6]','$_POST[column7]','$_POST[column8]')";For me like this, Only one $sql values are only inserting, $sql2 values are not inserting.Thanks in Advance Link to comment https://forums.phpfreaks.com/topic/286433-inserting-into-two-tables-at-same-time/ Share on other sites More sharing options...
.josh Posted February 23, 2014 Share Posted February 23, 2014 Post the code that actually executes it. Multiple queries in a single request may or may not be possible, depending on what code you're using. Link to comment https://forums.phpfreaks.com/topic/286433-inserting-into-two-tables-at-same-time/#findComment-1470209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.