Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IS a Double insert illegal?

Posted on 2002-06-11
5
Medium Priority
?
324 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 200 total points
ID: 7070935
yes
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

886 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