Created
August 17, 2016 16:49
-
-
Save anjan011/152d2e9c4fc833a0aefc2599e4f80f0c to your computer and use it in GitHub Desktop.
mysql sample limit clause generation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pageNo = isset($limitParams['_ticketPage']) ? (int)$limitParams['_ticketPage'] : 1; | |
if($pageNo < 1) { | |
$pageNo = 1; | |
} | |
$recordsNo = isset($limitParams['_ticketRecords']) ? (int)$limitParams['_ticketRecords'] : 20; | |
if($recordsNo < 1) { | |
$recordsNo = 1; | |
} | |
$offset = ($pageNo - 1) * $recordsNo; | |
$limitClause = " limit {$offset},{$recordsNo}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment