I need to count a number of records in a table that meet two conditions, the problem is that you are only telling me one record. This is my function:
public function NewClients(){
$fecha_inicio = date('Y-m-01');
$fecha_fin = date('Y-m-t');
$sql = $this->pdo->prepare("SELECT COUNT(id_nivel),date_register FROM usuarios
WHERE id_nivel = 2 AND date_register
BETWEEN '$fecha_inicio' AND '$fecha_fin'");
$sql->execute();
echo $sql->rowCount();
}
I am printing that there is only one record, but in my table there are two records that meet that condition.