Generating SQL statements - 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: Generating SQL statements (/showthread.php?tid=35704) |
Generating SQL statements - El Forum - 11-08-2010 [eluser]pyronate[/eluser] Pardon if there is a simple way to do this but I am new to CodeIgniter . What’s the best way to delete a bunch of id’s from a table using the $this->db->delete function? I currently get a bunch of "components" from a view and from the model I get the following array contained in components[] and is as such: Code: Array Generating SQL statements - El Forum - 11-08-2010 [eluser]cahva[/eluser] Code: $this->db->where_in('id',$array)->delete('components'); That would create SQL to something like this: Quote:DELETE FROM components WHERE id IN (57,58,56,...); |