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

You need to use a join to join the two tables.

You could do something like:

PHP Code:
$this->db->from('invoice');
$this->db->join('customer''invoive.cusid  = customer.cid');
$this->db->like('cusname '$search); 

Since a customer can have more than one invoice, I would suggest you check the query with something like:

PHP Code:
$query $this->db->get();
if (
$query->num_rows() > 0)
{
 
  $results $query->result_array();
}
else
{
 
  $results FALSE;


There are some great help documents on all this:
http://www.codeigniter.com/user_guide/da...eries.html
http://www.codeigniter.com/user_guide/da...sults.html

Best wishes,

Paul.
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