Jump to content

multiple table single query


woody`

Recommended Posts

Hello all,

        How can you achieve in inserting a record to a multiple table in a single query.
          $query_mboard= "INSERT INTO mboard VALUES ('','$mboard_desc','$mboard_serial')";
          $query_pcset = "INSERT INTO pcset VALUES('','$pcname')";
          $query_cpu  = "INSERT INTO cpu VALUES('','$cpu_desc','$cpu_serial')";  <--------------- Im going to insert some records into 3 tables.

          $result = mysql_query($query_cpu);    <---- Id also like to query it if it went through coz im using a unique id in some of the rows
            if($result==1)
                      {
                      echo "<img src=links/ok.png>Added to database";
                        }
                      else
                        {
                      echo "<img src=links/failed.png>Failed adding to Database";
                      }

    Regards,
    - woody
Link to comment
https://forums.phpfreaks.com/topic/26739-multiple-table-single-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.