How to run multiple insert query in SQL using PHP in one go?

How to run multiple insert query in SQL using PHP in one go?

In PHP programming language we can run multiple SQL Query in a on go. It means we can store data into a multiple table by using one submit button. It is a very simple process to send multiple data to multiple MySql table in PHP. The below list of code you shows that how we can store data into multiple table by using multiple select statement by one click.

    if (isset($_POST['submit'])) {
//upload Data in database
$query1="insert into table1() values ('$value1','$value2')";
$query2="insert into table2() values ('$value1','$value2')";
$query3="insert into table3() values ('$value1','$value2')";
$data_1=mysqli_query($conn, $query1);
$data_2=mysqli_query($conn, $query2);
$data_3=mysqli_query($conn, $query3);
}

just write the above code in to your respective page it will save the data in to your database in multiple table as well. If you find any problem by doing this please let us know we will solve your query.

don't forget to write comment below and share with your friends if you helps this article.

Also Read:

How instagram algorithm works in 2020

Post Comments(0)

Leave a reply