I have this query:
$butacas= $this->pdo->prepare('SELECT COUNT( * ) FROM `usuarios` WHERE `sala` LIKE :nombreSala');
$butacas->bindValue(':nombreSala', $nombreSala);
$butacas->execute();
echo $butacas->rowCount();
This query results in an integer: 1
if I replace :nombreSala
with the value that actually exists in the database, like:
SELECT COUNT( * ) FROM usuarios WHERE sala LIKE 'salaChica'
It still results in 1.
Now, when checking the database with phpMyadmin I realise that with that value (salaChica) there are 2 items instead of one! (and consulting from phpMyadmin does result in 2).
Why it is not accurate? I've read this post about that function not being always accurate with SELECT, but is there a simple alternative?