Solved

IS a Double insert illegal?

Posted on 2002-06-11
5
309 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now