CI framework AR operations (array form) implement the method of inserting multiple SQL data, ciar. CI framework AR operations (array form) to insert multiple SQL data. ciar this article describes how to insert multiple SQL data using CI framework AR operations. For your reference, the CI framework AR operation (array form) implements the method of inserting multiple SQL data, ciar
This article describes how to insert multiple SQL data records using the CI framework AR operation. We will share this with you for your reference. The details are as follows:
If you do not use AR, you can do this:
Insert into table (FIELDS) VALUES ('1', '2'), ('3', '4'); $ this-> db-> query ($ SQL );
I personally like the AR operation of CI. in the old version (about 2.0), there should be no operation to insert multiple data entries. The new version can be used:
$ This-> db-> insert_batch ();
Example:
$ Data = array ('name' => 'php', 'URL' => 'http: // www.bkjia.com '), array ('name' => 'customer home', 'URL' => 'http: // www.bkjia.com '); $ this-> db-> insert_batch ('mytable ', $ data );
The preceding SQL statement is as follows:
The code is as follows: insert into mytable (name, url) VALUES ('php', 'http: // www.bkjia.com '), ('customer home', 'http: // www.bkjia.com ')
Summary: data parameters in the database quick operation class in the ci framework are generally one-dimensional associated arrays..