I'm starting with the use of PDO and I have a question I could not solve. I do the select below that will return me 2 times:
$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 not store the results, below I can display both, but how could I store them in different variables?
foreach ($saidas as $saida) {
echo $saida['horario'];
}