I am doing a record counter, but it is not showing me the total number of records. What am I doing wrong?
Here I make the connection
require_once '../Controlador/conexion.php';
$objeto = new Conexion();
$conexion = $objeto->Conectar();
Here I do the procedure to show me the number of records, but it only shows me one
<?php
$consulta = "SELECT id FROM reportes WHERE estatus = 1 ";
$resultado = $conexion->prepare($consulta);
$resultado->execute();
$data = $resultado->fetchColumn();
echo '<h4> Total: ' . $data . '</h4>';
?>
It is only showing me one record, when I should put two.
If you want to count the rows that meet your query criteria, you should write a statement like
COUNT(*)
. For example: