Mysql Join query Codeigniter
code loads and initializes the database class based on yourconfiguration settings.
$query = $this->db->query('SELECT name, title, email FROM my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
echo 'Total Results: ' . $query->num_rows();
Mysql Join query Codeigniter
$this->db->select('*');
$this->db->from('tbl1');
$this->db->join('tbl2', 'tbl1.id = tbl2.id');
$this->db->join('tbl3', 'tbl1.id = tbl3.id');
$query = $this->db->get();
The above get() function retrieves all the results
from the supplied table.