Welcome Guest, Not a member yet? Register   Sign In
search in codeigniter
#1

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);
Reply


Messages In This Thread
search in codeigniter - by egypure - 07-20-2016, 11:17 PM
RE: search in codeigniter - by PaulD - 07-21-2016, 03:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB