Advertisement
ak47suk1

search keyword

May 26th, 2011
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1.     function searchKeyword() {
  2.  
  3.         $searchMe = $this->uri->segment(3);
  4.         $sortBy = $this->uri->segment(4);
  5.         if (!empty($searchMe)) {
  6.             $this->db->select('word,domain_name,scale_name');
  7.             $this->db->from('eloki_keyword');
  8.             $this->db->join('eloki_domain', 'eloki_keyword.domain_id =
  9.                eloki_domain.domain_id', 'left');
  10.             $this->db->join('eloki_scale', 'eloki_keyword.scale_id =
  11.                eloki_scale.scale_id', 'left');
  12.  
  13.             $this->db->like('word', $searchMe);
  14.  
  15.  
  16.             $this->db->order_by($sortBy, "asc");
  17.  
  18.  
  19.  
  20.  
  21.  
  22.             $q = $this->db->get();
  23.             if ($q->num_rows() > 0) {
  24.                 foreach ($q->result() as $row) {
  25.                     $data[] = $row;
  26.                 }
  27.  
  28. //$data['counter'] = $q->num_rows();
  29.  
  30.                 return $data;
  31.             }
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement