I have a query SQL
that brings the data that I want perfectly. When doing a print_r
it shows it to me like this:
Array ( [0] => 6 [idFormacion] => 6 ) Array ( [0] => 9 [idFormacion] => 9 )
Array ( [0] => 12 [idFormacion] => 12 ) Array ( [0] => 14 [idFormacion] => 14 )
Array ( [0] => 15 [idFormacion] => 15 ) Array ( [0] => 16 [idFormacion] => 16 )
What I try is to save each value of the array in independent variables.
$valor1 = 6;
$valor2 = 9;
EDIT
My query SQL
:
SELECT alumnos_formacion.idFormacion
FROM alumnos_formacion INNER JOIN formacion
on alumnos_formacion.idFormacion = formacion.idFormacion
WHERE alumnos_formacion.NIA=12345
EDIT 2
So far I have echoed this:
while($fila2 = $objetoBBDD->devolverFilasAssoc())
{
foreach ($fila2 as $indice => $array)
{
${'valor: '.$indice} = $array;
echo $array;
echo "<br>";
}
}
What it shows me are the rows with the data I need:
6
9
12
14
15
16
What I can not get is to put each value in independent variables. For example:
$formacion1 = 6
$formacion2 = 9
etc.