Insert records into multiple tables in php

I found this tutorial on tizag.com. But it is designed to display records from different tables. How to make an insert?

         <?php
    // Make a MySQL Connection
   // Construct our join query
      $query = "SELECT family.Position, food.Meal ".
      "FROM family, food ".
"WHERE family.Position = food.Position";

      $result = mysql_query($query) or die(mysql_error());


      // Print out the contents of each row into a table 
     while($row = mysql_fetch_array($result)){
echo $row['Position']. " - ". $row['Meal'];
echo "<br />";
      }
      ?>
0
source share
2 answers

Do you mean inserting data into several database tables with one query?
You can not.

Read the MySQL INSERT syntax link .

Of course, you can iterate over your data and, for example, insert it into different tables step by step, but without real code, it is difficult for you to help.

+1
source

One site has a tutorial: SQL Tutorial - Insert

: PHP MySQL

0

All Articles