|
本帖最后由 linger308 于 2009-4-23 11:09 编辑
最近在做一个查询,查询条件是用户可以选择、并的关系。当用户点击提交查询时把参数POST到另一个页面,而在此页面把查询的结果分页显示时遇到问题是如何传递参数,求救!!!
代码如下:
function searesult($start=0)
{
$truname=$this->input->post('truname');
$job =$this->input->post('job');
$city =$this->input->post('city');
$qq =$this->input->post('qq');
$username=$this->input->post('username');
$email =$this->input->post('email');
$tel =$this->input->post('tel');
$sn =$this->input->post('sn');
$meiti =$this->input->post('meiti');
$begin =$this->input->post('begin');
$end =$this->input->post('end');
$aWhere=array();
$where='';
if($truname)
{
$aWhere['truname']=$truname;
}
if($job)
{
$aWhere['job']=$job;
}
if($city)
{
$aWhere['city']=$city;
}
if($qq)
{
$aWhere['qq']=$qq;
}
if($username)
{
$aWhere['username']=$username;
}
if($email)
{
$aWhere['email']=$email;
}
if($tel)
{
$aWhere['tel']=$tel;
}
if($sn)
{
$aWhere['sn']=$sn;
}
if($meiti)
{
$aWhere['meiti']=$meiti;
}
if($begin)
{
$aWhere['begin']=$begin;
}
if($end)
{
$aWhere['end']=$end;
}
foreach($aWhere as $i=>$value)
{
if($i=='begin')
{
list($a1,$a2,$a3)=explode("-",$value);
$value=mktime(0,0,0,$a2,$a3,$a1);
$where.=" and date >'$value'";
}else if($i=='end')
{
list($a1,$a2,$a3)=explode("-",$value);
$value=mktime(0,0,0,$a2,$a3,$a1);
$where.=" and date <'$value'";
}else{
$where .=" and $i='$value'";
}
}
$where=substr($where,4);
$conf['per_page']=15;
$conf['total_rows']=$this->InfosearchM->getAlltotalCount($where);
$conf['uri_segment']=3;
$conf['base_url']=site_url()."/infosearch/searesult/";
$this->load->library('pagination');
$this->pagination->initialize($conf);
$temp['links']=$this->pagination->create_links();
$temp['res']=$this->InfosearchM->getAllLimitRows($conf['per_page'],$start,$where);
$temp['per_page']=$conf['per_page'];
$temp['total_rows']=$conf['total_rows'];
$this->load->view("searesultV",$temp);
}
现如何把$where 参数 传递?? |
|