How to list all the data in this query, I can only display the first line but I want to query all of them and show them.
public function gerarCardapio(){
try{
$cat = "M";
$sql = "SELECT * FROM alimentos WHERE id_usuario = :idUser AND categoria = :cat AND quantidade >0 ";
$stmt = DB::prepare($sql);
$stmt->bindParam('idUser', $_SESSION['user_id']);
$stmt->bindParam('cat', $cat);
$stmt->execute();//Executa o comano SQL
$result = $stmt->fetch(PDO::FETCH_ASSOC);
echo $stmt->rowCount();
}catch (PDOException $e){
echo $e->getMessage();
}
}