-1
I have the event table and would like to return all rows of a Mysql query through the foreach in PHP, but it returns only the first line, can help me?
Follows the code:
<?php
include_once('evento/action/conexao.php');
    $database = new Database();
    $db = $database->conectar();
$data_selecionada = '2021-02-19';
$sql = "SELECT TIME(eventos.inicio) as ini, TIME(eventos.termino) as fim FROM eventos WHERE DATE(eventos.inicio) = '$data_selecionada' ORDER BY inicio";
$horarios = array();
$res = $db->prepare($sql);
$res->execute(); 
$dados = $res->fetch(PDO::FETCH_ASSOC);
foreach($dados as $dado) {
    echo "</br>" . $dado;
}
thank you very much, it worked!
– Jesse Ribeiro