Im trying to devellop a pagination system and Im having an strange issue. I have this code below and the code is always entering in my if condition saying there are 0 results. But I have the sql statment correct when I do a print_r. Can you see if theres something wrong that I´m not seeing?
$pag = (empty($_GET['pag']) ? '1' : $_GET['pag']);
$max = 3;
$begin = ($pag * $max) - $max;
$readPages = $pdo->prepare("SELECT * FROM pages where id_numb IS null LIMIT :beg,:ma");
$readPages->bindValue(":beg", $begin);
$readPages->bindValue(":ma", $max);
$readPages->execute();
$num_rows = $readPages->rowCount();
if(!$num_rows >= 1)
{
echo '0 results';
}