I have this query to my database it's working fine, I tested it in PHPMyAdmin. my problem is that I am trying to display the result in my page but I get blank output with no error
what am I doing wrong?
$count_fields = "SELECT SUM(agent_status = '1' ) AS 'agent'
, SUM(agent_status = '0' ) AS 'agentoff'
, SUM(admin_status = '0' ) AS 'admin'
, SUM(user_id = '$id' ) AS 'user'
FROM property WHERE user_id = '$id'";
$count_res = $conn->prepare($count_fields);
$count_res->execute();
$count = $count_res->fetchAll();
i created a foreach loop like
foreach ($count as $cnt){
echo $cnt['agent']
}
but the result is blank...
foreach
loop – Alon Eitan May 4 '19 at 19:27