Pagination in single Query

What people normally do in the code? Example: //query to count total records $result = mysqli_query($conn,”SELECT COUNT(*) total FROM test”); //getting count if($result) { $totalRows=mysqli_num_rows($result); if($totalRows==1) { $resultData=mysqli_fetch_assoc($result); $total=$resultData[‘total’]; //total count in a variable } else{ echo “No rows found”;…