I get via Ajax a $_POST
request with 5 indexes and the last 3 are Arrays.
It looks something like this:
Array
(
[c] =>
[s] =>
[dt] =>
[nl] => Array
(
[0] => valor1
[1] => valor2
[2] => valor3
)
[ol] => Array
(
[0] => valor1
[1] => valor2
[2] => valor3
)
[cat] => Array
(
[0] => valor1
[1] => valor2
[2] => valor3
)
[save] => save
)
The indexes "c", "s" and "dt" are being saved in a table:
primeira tabela
id | campaign_name | subject | date
AI | $_POST['c'] | $_POST['s'] | $_POST['dt']
and if they are inserted, the other indexes ("nl", "ol" and "cat") are saved in another table:
id | main_url | new_url | access_count | campaign_FK
AI | $_POST['ol'] | $_POST['nl'] | NULL | id_primeira_tabela
Referencing the id
of the first insertion.
The first query runs ok.
My problem is to mount the correct query for the second insertion.
I have already used foreach, for, tried to insert one by one and then give an UPDATE (gambiarra). I researched quite a bit on Google as well and none of the searches served that doubt.
Can anyone help me?