If you don't use ar, you can do this:

insert into table (fields) values ​​("1", "2"), ("3", "4");
$this->db->query ($sql);

Personally, I still like the ar operation of ci. The old version (below 2.0) should not have the operation of inserting multiple pieces of data.The new version is available:

$this->db->insert_batch ();

The following cases:

$data=array (
 array (
  "name" =>"php", ), array (
$this->db->insert_batch ("mytable", $data);

The above generated SQL looks like this:

Summary:The data parameters in the database shortcut operation class in the ci framework are generally one-dimensional associative arrays.

  • Previous Chapter 54 of Manipulating Data in ASPNET 20: Including a File Upload Option When Adding New Records
  • Next Analysis of CI framework file upload and image processing