IS a Double insert illegal?

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?
sargentoAsked:
Who is Participating?
 
andreifCommented:
yes
0
 
vasan_srCommented:
ys...it is possible for inserting into 2 tables with one tables...
0
 
andreifCommented:
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
 
sargentoAuthor Commented:
So it is legal to make to insertions in one right after the other like my example?
0
 
sargentoAuthor Commented:
So it is legal to make two insertions, one right after the other like my example?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.