Welcome Guest, Not a member yet? Register   Sign In
insert_batch() not working completely

If you really want to use a batch function for arrays with different key => value pairs you will need to create a custom batch function that will create an insert for each array element.

But as RBX wrote
(04-19-2017, 08:50 AM)RBX Wrote: That's expected.

Check the MySQL documentation, you can define columns only once.

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

This is the expected behavior for a bulk insert. It's not a bug or flaw in CodeIgniter

I would advise you use the solution I provide. Just set all the columns in your array and only pair the values you need for each record.
To make it easy, create a method that holds a default array with all columns set as keys with empty values.

Messages In This Thread
RE: insert_batch() not working completely - by Martin7483 - 04-25-2017, 06:12 AM

Theme © iAndrew 2016 - Forum software by © MyBB