My question is about inserting data with CodeIgniter Active record. There’s an example on the guide to insert data with array:
$data = array(
'title' => 'My title' ,
'name' => 'My Name' ,
'date' => 'My date'
);
$this->db->insert('mytable', $data);
I wonder if there is some other way to insert the active record data, For example in in similar syntax:
$this -> db -> select (*);
$this -> db -> from ('users');
$this -> db -> where('id', $id);
$this -> db -> limit(1);
$query = $this->db->get();
Thanks.
You may use
set()method.According to CI documentation, you may use following syntax:
which will produce following query:
Hopefully it’s what you’re looking for.