Update database.php

This commit is contained in:
Namhyeon Go 2018-02-26 18:15:56 +09:00 committed by GitHub
parent 856c35686a
commit 9159fe239a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,5 +109,19 @@ if(!function_exists("exec_db_fetch_all")) {
}
}
if(!function_exists("get_page_range")) {
function get_page_range($page=1, $limit=0) {
$append_sql = "";
if($limit > 0) {
$record_start = ($page - 1) * $limit;
$record_end = $record_start + $limit - 1;
$append_sql .= " limit $record_start, $record_end";
}
return $append_sql;
}
}
// set global db connection variable
$dbc = get_db_connect();