tejoprabowo tejoprabowo - 3 years ago 199
PHP Question

How do I insert the data array to 8 tables at once?

I have a variable with the contents of the array is as below

$dataRoles = [
0 => [

1 => [

and I have 2 tables table role_0, and role_1.

How to insert a data array 0 => '....' to the table role_0 and array 1 => '....' to the table role_1

Answer Source

It's impossible to make insert into 2 different tables. It's only possible to insert into 1 table but many records using bulk insert e.g:

insert into table (fld1, fld2) values ("val1", "val2"), ("val3", "val4"), ... 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download