2
I’m starting with the use of PDO and I have a doubt that I could not solve. I do the select below that will return me 2 hours:
$sqlSaida = 'SELECT horario
FROM HORARIOS
WHERE COD = :codsaida
UNION
SELECT horario
FROM HORARIOS
WHERE COD = :codretorno;';
$resSaida = $conexao->prepare($sqlSaida);
$resSaida->execute(array(
':codsaida' => $codsaida,
':codretorno' => $codretorno
));
$saidas = $resSaida->fetchAll();
But I can’t store the results, below I can display both, but how could I store them in different variables?
foreach ($saidas as $saida) {
echo $saida['horario'];
}
What is the purpose of these variables?
– rray
I need to pass them on another select forward.
– Diego
Which select from the front? did not give to understand what is your goal with that code.
– rray
i do this select and I will use the result in another select and then in an Insert.
– Diego
Edit the question and add this information and code as well. This query returns a line or more?
– rray
The answer below solved my doubt. Thank you.
– Diego
The response mounted array has the same structure as
$saidas
. If it worked out for you :)– rray