Again I come to ask for help, this time I have to save the values of a variable inside an array and then show them, this variable is within a foreach cycle, I leave the code:
$strProyecto = $conex->getIndCol('id', sqlProyectos());//proyectos válidos.
if ($opcion3 == 'save') {
$proyecto_id = filter_input(INPUT_POST, 'proyecto_id', FILTER_VALIDATE_INT);//id del proyecto seleccionado
if ($proyecto_id > 0) {
$aProyecto = array("proyecto_id"=>$proyecto_id);//id del proyecto seleccionado convertido en array para que sea parámetro de getTareasPendientes
$tareasP = Tarea::getTareasPendientes($conex, '', $aProyecto);//datos de tareas pendientes del proyecto seleccionado
foreach ($tareasP as $ids) {
$tarea_id = $ids['id'];
$_Tarea = new Tarea($tarea_id, $conex);
$_Tarea->cancelarTarea($sys_Usuario, $proyecto_id);//método para cancelar tareas pendientes
}
}
}
I have the variable $tarea_id
that contains the id
of the task, because I have to save a record in the history I have to do the task cancellation by task ( $_Tarea->cancelarTarea...
), but to show all id
of the tasks that were canceled I want to save them in array
to then make a echo json_encode
.
One of the options I saw was something like this:
foreach($activities as $k => $v) {
$a[] = $v['name'];
}
but since I use $tarea_id
in $_Tarea = new Tarea($tarea_id, $conex);
I can not pass it directly to array
within the cycle, so I do not know how to do it.
Thank you in advance (: