Insert Multiple Values on a single query |
[eluser]guidorossi[/eluser]
Hi! I'm wondering if there is any way to do inserts of multiple values on a single query using active record. Something like: Code: INSERT INTO people (name, age) I've tried with a loop like: Code: $data = array( Code: $this->db->insert('people', $data); This works, but it seems to make each values insert on a new query. EDIT This isn't really working, its only inserting the last item of the array, I think it should be something like: Code: $data[$i] = array( but with this code I get: Quote:A PHP Error was encountered
[eluser]SPeed_FANat1c[/eluser]
With transanctions you could use multiple queries but result would be like you use one query - if any of them fails, everything is undone back to original database state. I anwered how to use them there: http://ellislab.com/forums/viewthread/177655/
[eluser]guidorossi[/eluser]
Thanks Cristian I'm already implementing something like that wiki says, but I thought that maybe CI has this function incorporated and I was missing something |
Welcome Guest, Not a member yet? Register Sign In |