Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

Insert Query in Codeigniter

by
Category: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')

0 Comments


Html code work in comment box


Related Post