Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

search in codeigniter

$
0
0
hello 

i have 2 table 

1 customer 
-----------------------------------------------------
id   | cusname            | phone
1    | any1                  |00000
2    | any2                  |12333



2 invoice 
-------------------------------------------------------
id  | cusid      |  any
1   | 1
2   | 1
3   | 2
4   | 2
5   | 1


i want search in table 2 with name in table 1 

get id from table 1 to 


i try 


custmodel

public function get_cust_id($search)
    {
$this->db->select('id');
$this->db->from('customer ');
$this->db->like('cusname ', $search);
$query = $this->db->get();
return $query->row_array(); 
    }
 


in invoice model 
$custtid=$this->cust_model->get_cust_id($search_string);

$this->db->where('cusd',$custtid);

Viewing all articles
Browse latest Browse all 14343

Trending Articles