Necesito contar todos los registros que tenga este identificador pub-1374077Q
Realice el siguiente procedimiento:
$id_pub = "pub-1374077Q";
$stmt=$con->prepare("SELECT id FROM visitors_table where publishers=?");
$stmt->bind_param("s",$id_pub);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($id);
if ($stmt->num_rows>0) {
return $stmt->affected_rows;
} else {
echo "0 registros";
}
pero no me ejecuta ningún error, no me muestra nada.