Link to home
Start Free TrialLog in
Avatar of sargento
sargento

asked on

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?
Avatar of vasan_sr
vasan_sr

ys...it is possible for inserting into 2 tables with one tables...
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)
Avatar of sargento

ASKER

So it is legal to make to insertions in one right after the other like my example?
So it is legal to make two insertions, one right after the other like my example?
ASKER CERTIFIED SOLUTION
Avatar of andreif
andreif
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial