1
As I do to execute 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 make the code cleaner and clean, so I wanted to know how to run the line $con->query($sql, PDO::FETCH_ASSOC) as $row
" without needing the 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){
}