2
I’m trying to create a query as follows:
I have a table in the database with this structure:
name | address | status
The status field only has 2 types of values 1 or 0. I want to count all records that are status 0
I made the following query:
select count(*) as total from sv_mensagens where status = 0
In PHP I made the following code using PDO:
$this->pdo = ConnDB::conexao();
$query3 = "select count(*) as total from sv_mensagens where status = 0";
$conta2 = $this->pdo->prepare($query3);
$conta2->execute();
while ($result = $conta2->fetchAll()){
echo $result['total'];
}
only that error occurs and does not work what I want to bring is the result of counting all records that are status in 0.
Which error is it? could post message?
– rray
I tried to improve the question, to be easier to understand, in case you think it better to go back to the old one, just click here and click on
reverter– MarceloBoni
To
querywhen executed in Mysql works normally?– R.Santos
thanks bonifazio get the will thank you even :D
– mfurlan