CodeIgniter Forums

Full Version: HELP ME OUT,Paginations Based on Conditions,i tried but uri not working!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Like this i am having 6 values are coming from view to controller function,after that based on values i am doing search like this
//code starts//if($A != null && $b == null && $c == null && $d == null && $e == null && $f == null )
{
if($A == 'Any'){
$this->load->My_Model->seach_itemswithany();}
else{$this->load->My_Model->seach_itemsall($any)}
}
Like this i am getting the values from db,total 240 if and elseif loops i written for the differrent pages,so how can i put pagination for this based on conditions?
HELP ME OUT!
here the sample code
Code:
//only year selection
  elseif($make == null && $model == null && $FromnewPrice == null && $TonewPrice == null && $states == null && $cities == null && $year != null)
  {
       if($year == 200014)
    {
    $data['newcar'] = $this->Buy_Model->search_newcarALL();
    }
    else
    {
    $data['newcar'] = $this->Buy_Model->search_newcarbyyear($year);
    }
  
  }//only price selection
  elseif($make == null && $model == null && $FromnewPrice != null && $TonewPrice != null && $states == null && $cities == null && $year == null)
  {
       $data['newcar'] = $this->Buy_Model->search_newcarbyprice($FromnewPrice,$TonewPrice);
  }//only state selection
  else
  if($make == null && $model == null && $FromnewPrice == null && $TonewPrice == null && $states != null && $cities == null && $year == null)
  {
    if($states == 'ANY')
    {
     $data['newcar'] = $this->Buy_Model->search_newcarALL();
    }
    else
    {
    $data['newcar'] = $this->Buy_Model->search_newcarbystate($states);
    }
  }//make and year
  else
  if($make != null && $model == null && $FromnewPrice == null && $TonewPrice == null && $states == null && $cities == null && $year != null)
  {
    if($make == 786 && $year == 200014)
    {
     $data['newcar'] = $this->Buy_Model->search_newcarALL();
    }
    else if($make == 786 && $year != 200014)
    {
     $data['newcar'] = $this->Buy_Model->search_newcarbyyear($year);
    }
    else if($make != 786 && $year == 200014)
    {
     $data['newcar'] = $this->Buy_Model->search_newcarbymake($make);
    }
    else
    {
     $data['newcar'] = $this->Buy_Model->search_newcarbymakeyear($make,$year);
    }
  }//make and price
your help is appreciated