0
I’m having a problem, I want to know how much data there is in the database, but with this code is returning -1 I have already used this code for other jobs (only with mysql), in this case it is with SQL Server
$pag = (isset($_GET['pag'])) ? strip_tags((int)$_GET['pag']) : '1';
$maximo = '6';//produtos por pagina
$stmt2 = $conn->prepare("SELECT * FROM cl");
$stmt2->execute();
$totalRegistros2 = $stmt2->rowCount();
$paginas2 = ceil($totalRegistros2/$maximo);
if(isset($_GET['pag'])){
if (($_GET['pag']>$paginas2)||($_GET['pag']<1)){
$pag=1;
}
}
$inicio = ($pag * $maximo) - $maximo;
echo $totalRegistros2;
echo $count;
Thank you very much for your help.
– Xeoon