CodeIgniter: insert data into database

Hi guys! In this tutorial I will explain how you can insert data into database by using CodeIgniter Framework.

If you want to insert data into database with CodeIgniter:

  • Open your controller.
  • Create a new function.
  • Create an array with the fields from your database and the data you want to insert:¬†$data = array("title"=>"new information");
  • Use this function¬†$this->db->insert("data",$data); to insert your data. "data" is the name of my table.

In this way you can easily insert data into your database.

Video tutorial:









Leave a Comment