CodeIgniter Forums
getting the insert_id from insert_batch - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: getting the insert_id from insert_batch (/showthread.php?tid=42202)



getting the insert_id from insert_batch - El Forum - 05-30-2011

[eluser]Clooner[/eluser]
I'm not sure if this is possible but I want to retrieve the inserted id's from the insert_batch function. If I use the insert_batch function I only get the first inserted id and not the full list of inserted id's. Is there a way to retrieve these or do I just have to loop the regular insert in this case?


getting the insert_id from insert_batch - El Forum - 05-30-2011

[eluser]jmadsen[/eluser]
from what I could tell looking at the DB_Active_Rec file, the insert_batch() is only manipulating your array into a bunch of separate INSERT strings and running them one at a time.

You would do just as well (and it may be the only way) with a loop, but I'm not the authority on this.


getting the insert_id from insert_batch - El Forum - 05-30-2011

[eluser]mahni1390[/eluser]
[url="http://www.parscanada.com"]مهاجرت به کانادا[/url]