Solved

IS a Double insert illegal?

Posted on 2002-06-11
5
317 Views
Last Modified: 2008-03-17
Can you do something like this:

$result = mysql_query($sql,$connection) or die("Couldn't execute insert.");
     
         
$result2 = mysql_query($sql2,$connection) or die("Couldn't execute 2nd insert.");


If not is it possible to insert into 2 different tables in one statement?
0
Comment
Question by:sargento
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:vasan_sr
ID: 7069494
ys...it is possible for inserting into 2 tables with one tables...
0
 
LVL 6

Expert Comment

by:andreif
ID: 7069652
yes, you can - there is no way to insert into 2 tables with one SQL.

TIP: if you insert 2 records into the same table you can use

insert into TABLE (field1,field2) values (val1_1,val_2),(val2_1,val2_2)
0
 

Author Comment

by:sargento
ID: 7070918
So it is legal to make to insertions in one right after the other like my example?
0
 

Author Comment

by:sargento
ID: 7070929
So it is legal to make two insertions, one right after the other like my example?
0
 
LVL 6

Accepted Solution

by:
andreif earned 50 total points
ID: 7070935
yes
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question