Heim >Backend-Entwicklung >PHP-Tutorial >php与mysql分页问题,为什么别的界面都能用单独这个的下一页不能用,这么写有问题,该怎样修改
php
function get_links_list_all($key)
{
$result = get_filter();
if ($result === false)
{
$filter = array();
$filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'user_id' : trim($_REQUEST['sort_by']);
$filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
$sql = 'SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('users')." WHERE employee_key='$key'";
$filter['record_count'] = $GLOBALS['db']->getOne($sql);
<code> $filter = page_and_size($filter); $sql = 'SELECT * FROM ' .$GLOBALS['ecs']->table('users'). " WHERE employee_key='$key'"; set_filter($filter, $sql);}else{ $sql = $result['sql']; $filter = $result['filter'];}$res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);$list = array();while ($rows = $GLOBALS['db']->fetchRow($res)){ date_default_timezone_set('PRC'); $rows['reg_time']=date('Y-m-d H:i:s',$rows['reg_time']); $list[] = $rows;}return array('list' => $list, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);</code>
}