Buy Now
Sign in

Show full array from DB_READ using foreach in PHP

Kronosites , October 01 at 11:06
K
Kronosites

Hello!

I'm trying to show ARRAYS using "foreach" in customcode on CCv5.

I let you all the info below, could you help me please?

I have 2 arrays, one called CCT and other one called Data12:
Here img capture: https://imgur.com/MhWvJnl
Here the code:

				Array
(
[cont] => lists
[ccname] => monlistado
[act] => edit
[gcb] => 1
[CCT] => Array
(
[id] => 1
[uniq_id] => 726a43b057c4efa01756d64336e0c037f9e4eb78
[user_id] => 660
[created] => 2017-09-30 18:00:38
[modified] => 2017-09-30 20:18:24
[modified_userid] => 661
[s01p04id_investigador] => investigador
[s01p04monitor] => 661
[s01p04id_paciente] => in31ve3691
[s01p01notasdeseccion] => Notas de ejemplo de la sección
[s01p01tipopaciente] => 1
[s01p01fecha_de_nacimiento] => 09-05-2007
[s01p01fecha_de_ingreso] => 13-09-2017
[s01p01s01p01fecha_de_ingreso_ninv] => esta es una nota de ejemplo para el monitor
[s01p02s01p01fecha_de_ingreso_nmon] =>
[s01p02s01p01fecha_de_ingreso_q] =>
[s01p01edad] => 10
[s01p01peso] => 80
[s01p01talla] => 180
[s01p01imc] => 24.69
)

[Data12] => Array
(
[0] => Array
(
[created] => 2017-09-30 18:00:39
[s01p04monitor] => 661
[s01p01s01p01fecha_de_ingreso_ninv] => notas del investigador para el monitor
[s01p02s01p01fecha_de_ingreso_nmon] =>
)

[1] => Array
(
[created] => 2017-09-30 18:01:52
[s01p04monitor] => 661
[s01p01s01p01fecha_de_ingreso_ninv] =>
[s01p02s01p01fecha_de_ingreso_nmon] => notas del monitor para el investigador
)

)

)



This is my php code on custom code to show all Data12 array:
				<?php
foreach($Data12 as $item):
echo '<span>'.$item['created'].'</span>';
echo '<span>'.$item['s01p04monitor'].'</span>';
echo '<span>'.$item['s01p01s01p01fecha_de_ingreso_ninv'].'</span>';
echo '<span>'.$item['s01p02s01p01fecha_de_ingreso_nmon'].'</span>';
endforeach;
?>