Hello, I have this code:
<<?php
include("conexao.php");
$pdo = conectar();
$buscarusuario = $pdo->prepare("SELECT * FROM tab_clientes WHERE ID=:id");
$buscarusuario->bindValue(":id",2,PDO::PARAM_INT);
$buscarusuario->execute();
$linha = $buscarusuario->fetchAll(PDO::FETCH_OBJ);
foreach ($linha as $listar) {
echo "E-mail: ".$listar->email."</br>";
var_dump($listar);
}
My problem is that echo
does not appear on the screen, I tested it with var_dump
and it shows the DB data. Using FETCH_ASSOC
of normal, but since I'm learning PDO, I wanted to do this using FETCH_OBJ
, too, but as I said, echo
is not displayed on the screen. Does anyone have an idea why this occurs or what other way to display it? Thank you!