The problem I have is what do I get a json
of a form, by doing the json decode
I get:
Array ( [curp_aval] => pemi940613hdfrdasr [nombre_aval] => Ivan [ap_pat_aval] => Perez
[ap_mat_aval] => Montiel [curp] => GACh940207hdasdfgh [nombre] => pablo javier
[ap_pat] => gomez [ap_mat] => casol [telefono] => Array ( [0] => 1451234123 )
[correo] => Array ( [0] => [email protected] ) [direccion] => 5 de febrero [no_ext] => 4
[no_int] => - [codigo_postal] => 54506 [colonia] => cuaxoxa [demarcacion] => rio frio
[entidad_federativa] => méxico [nivel_estudio] => Licenciatura [ocupacion] => estudiante )
These are the fields that I will insert in my table usuario
, up to this point I have no problem, the problem starts when I have to insert the phones that the user enters in my table agenda
and the emails that you enter in my table correo
, I do not know how to do that part in my model, since I'm using active record.
Controller
$data_array = json_decode($json_data, true);
foreach ($data_array as $data_row)
Model
$this->db->insert('usuario', $data_row);
endforeach;
How could I insert that data into different tables?