6
I receive via Ajax a request $_POST
with 5 indexes and the last 3 are Arrays.
It’s kind of 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
)
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 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 difficulty is in mounting the correct query for the second insertion.
I already used foreach, for, tried to insert one by one and then give an UPDATE (gambiarra). I searched enough on google also and none of the searches served for that question.
Can someone help me?
Have you tried
$_POST['ol[0]']
?– Roger Barretto
Already! You can not mount a single query using this index since there are 3 arrays for the same table. :/
– DeBarros