![]() |
Insert Bidimensional Array Into database - 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: Insert Bidimensional Array Into database (/showthread.php?tid=55238) |
Insert Bidimensional Array Into database - El Forum - 10-16-2012 [eluser]Juan Velandia[/eluser] Hello everyone, I have this array created into a controller Code: Array And in need to insert it into a table with an sql sentence like this: Code: insert into requisito_tramite (id_requisito, id_tramite) Values (1,1); I would like to pass the array data to a model and make it work, but I dont seem to get it. Could you please give an Idea or point me to a previous tread?. Thanks in advance Insert Bidimensional Array Into database - El Forum - 10-16-2012 [eluser]egy_programozo[/eluser] Hope this is what you wanted Code: class Requisito_tramite extends CI_Model { Insert Bidimensional Array Into database - El Forum - 10-16-2012 [eluser]CroNiX[/eluser] That is very wasteful. You can do this in a single query using insert_batch(). Code: $this->db->insert_batch('tablename', $your_array_from_above); Insert Bidimensional Array Into database - El Forum - 10-16-2012 [eluser]Juan Velandia[/eluser] Thanks to both of you. The insert_batch() worked like a charm. Thanks a lot! |