Solved

IS a Double insert illegal?

Posted on 2002-06-11
5
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 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