Skip to content

Instantly share code, notes, and snippets.

@anderson-marin26
Last active June 30, 2017 19:44
Show Gist options
  • Save anderson-marin26/eb7f151be695d64d2adf34737bff0cb2 to your computer and use it in GitHub Desktop.
Save anderson-marin26/eb7f151be695d64d2adf34737bff0cb2 to your computer and use it in GitHub Desktop.
<?php
$rec_limit = 20;
$sql = $con_cdr->prepare($query_count);
$sql->execute();
$rec_count = $sql->fetch(PDO::FETCH_ASSOC);
$rec_count = $rec_count['count'];
if($page != 0)
{
$offset = $rec_limit * $page;
}
else
{
$offset = 0;
}
$left_rec = $rec_count - ((int)$page * (int)$rec_limit);
$query_new = $query_select . "LIMIT $offset, $rec_limit";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment