Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Insert Query in Codeigniter

codeigniter mysql
Insert Query in Codeigniter

Generates an insert string based on the data you supply, and runs the query. You can either pass an array or an object to the function.

Note: All values are escaped automatically producing safer queries.

Let’s create a inser() method in codeigniter

$data = array(
        'title' => 'php',
        'name' => 'alex',
        'status' => '1'

$this->db->insert('mytable', $data);
// Produces: INSERT INTO mytable (title, name, status) VALUES ('php', 'alex', '1')


Html code work in comment box

Related Post