Tutorialsplane

Codeigniter insert Query example

Codeigniter Insert Query Example :

Insert data in Codeigniter


$this->db->insert() is used to insert data in codeigniter table.

Codeigniter Insert Query Example

$data = array(
               'id' => $id,
               'name' => $name,
               'email' => $email,
               'phone' => $phone
            );

$this->db->insert('table_name', $data);

This will generate the following Query :


 // INSERT INTO table_name (id,name,email,phone)values($id,$name,$email,$phone);