How do I run this code without foreach, it is completely empty and is only serving to give value to the attributes, so it is not listing anything, and I wanted to leave the code cleaner and cleaner, so I wanted to know how to do it execute the line $con->query($sql, PDO::FETCH_ASSOC) as $row
"without needing foreach
.
$con = new PDO("mysql:host=localhost; dbname=estagio;charset=utf8", "root", "");
$sql = "SELECT * FROM clientes WHERE id_cliente = '$_SESSION[id]'";
foreach($con->query($sql, PDO::FETCH_ASSOC) as $row){
}