本文整理匯總了PHP中dbex::getPage方法的典型用法代碼示例。如果您正苦於以下問題:PHP dbex::getPage方法的具體用法?PHP dbex::getPage怎麽用?PHP dbex::getPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dbex
的用法示例。
在下文中一共展示了dbex::getPage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: count
//$sql_count = "select count(1) from do_task where user_id = {$_SESSION['uid']} and (status=11 or status=21)";
$sql_count = "select count(1) from do_task where user_id = {$_SESSION['uid']} and status=11";
$count = $dbo->getCount($sql_count);
global $action_per_page;
$per_page = $action_per_page;
$total_page = ceil($count / $per_page);
if (isset($_GET['page']) && intval($_GET['page']) >= 1 && intval($_GET['page']) <= $total_page) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
// 提取當前用戶做過的任務的 任務id,任務屏顯名稱,任務傭金,任務類型 , 完成時間 按照時間倒序
// status: 11 - 正常完成;21 - 屏蔽;
$sql = "select task_id, task_type, owner_name, income, time from do_task where user_id = {$_SESSION['uid']} and do_task.status = 11 order by do_id desc";
$start = ($page - 1) * $per_page;
$sql_res = $dbo->getPage($sql, $start, $per_page);
} else {
if ('ader' == $_SESSION['role']) {
$sql_count = "select count(1) from task where owner_id = {$_SESSION['uid']}";
$count = $dbo->getCount($sql_count);
$per_page = 5;
$total_page = ceil($count / $per_page);
if (isset($_GET['page']) && intval($_GET['page']) >= 1 && intval($_GET['page']) <= $total_page) {
$page = intval($_GET['page']);
} else {
$page = 1;
}
// 提取當前用戶發布過的任務的 任務id,任務類型 任務基本傭金,任務期望數量,目前完成數量
$sql = "select task_id, type, base_price, amount, finish_amount, create_at, expire_in from task where owner_id = {$_SESSION['uid']} order by task_id desc";
$start = ($page - 1) * $per_page;
$sql_res = $dbo->getPage($sql, $start, $per_page);