$page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $perPage = isset($_GET['per-page']) && $_GET['per-page'] <= 20 ? (int)$_GET['per-page'] : 5; $start = ($page > 1) ? ($page * $perPage) - $perPage : 0; $replies = $db->prepare(" SELECT SQL_CALC_FOUND_ROWS (*) FROM replies JOIN profile ON replies.replyBy = profile.username WHERE replyThreadID=:replyThreadID LIMIT {$start}, {$perPage}"); $replies->bindParam(':replyThreadID', $ID); $replies->execute(); $replies = $replies->fetchAll(PDO::FETCH_ASSOC); $total = $db->query("SELECT FOUND_ROWS() as total"); echo $total;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)