dougan7523 2013-12-13 09:13
浏览 61

搜索分页不起作用

I am facing problem of pagination with searching not working.I am trying to paginate data with searching but there are no data paginate on second and third page.please help me.here is my code.

function paginationData($str,$num,$start,$sql,$perpage){
  $pagination = new Pagination; 
  $config['base_url'] = $str;
  $config['total_rows'] = $num;
  $config['per_page'] = $perpage;
  $config['cur_page'] = $start;
  $config['prefix'] = '&p=';
  $config['next_link'] = 'Next';
  $config['prev_link'] = 'Previous';
  $pagination->initialize($config); 
  $sql .= " LIMIT ".$start." , ".$config['per_page'];
  $res = qry($sql,2);   
  $data['listArr'] = $res;  
  $data['Total'] = $num;    
  $data['links'] =  $pagination->create_links();
  $data['per_page'] = $config['per_page']; 
  return $data;
}

$where = '';
$order_by = " ORDER BY parent_id,id_category ASC";  
$search = '';
$search = $_REQUEST['search'];
$search_term = $_REQUEST['word_search'];
if(@$search_term)
    $where = " where name like '%".$search_term."%'";
$sql = "select id_category,name,parent_id from category".$where.$order_by;      
$total_rec = qry($sql,3);
$page = $base_url.'categories.php?word_search='.$search_term;
$start = $_GET['p']?$_GET['p']:0;
//echo "<pre>";
//print_r ($total_rec);
//die();
$perpage=10;
$data = paginationData($page,$total_rec,$start,$sql,$perpage);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题