Hi friends How do we query from two tables in codeigniter using active record ? Can anyone pls show me how to insert in the fields of two tables while adding fields?
A:
Just use separate queries.
For selecting:
$query1 = $this->db->get('table1');
$query2 = $this->db->get('table2');
For inserting
$data1 = array(
'title1' => 'My title1' ,
'name1' => 'My Name1'
);
$this->db->insert('table1', $data);
$data1 = array(
'title2' => 'My title2' ,
'name2' => 'My Name2'
);
$this->db->insert('table2', $data);
Matthew
2010-08-12 16:00:32
is there a way to bind query in one statement for advance select statements like joins etc ?
sagarmatha
2010-08-16 22:53:35