Revision: 5634
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 20, 2008 20:33 by cburyta
Initial Code
/**
* A utility method that builds out the SQL for the LIMIT / OFFSET chunk of the SQL
*
* @param page the page that will be pulled, will affect the OFFSET
* @param perpage how many items per page, will affect the LIMIT
* @return string an SQL statement consisting of the LIMIT and OFFSET
*/
private function _buildLimitOffsetSQL($page,$perpage) {
$limit = (is_numeric($perpage) && $perpage>0) ? $perpage : 10;
$offset = (is_numeric($page) && $page>0) ? ($page-1)*$perpage : 0;
return "LIMIT $limit OFFSET $offset";
}
Initial URL
Initial Description
Initial Title
Utility PHP function to paginate SQL queries
Initial Tags
sql, php, textmate
Initial Language
PHP