INSERT IGNORE INTO - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: INSERT IGNORE INTO (/showthread.php?tid=34390) |
INSERT IGNORE INTO - El Forum - 09-28-2010 [eluser]Sire[/eluser] Is there a way to use Active Record $this->db->insert() to achieve an 'INSERT IGNORE INTO' statement? INSERT IGNORE INTO - El Forum - 09-28-2010 [eluser]Sire[/eluser] In the absence of a built-in way to manage it, I came up with: MySQL version Code: $insert_query = $this->db->insert_string('links',$link_data); SQLITE3 version Code: $insert_query = $this->db->insert_string('links',$link_data); Would you write it differently? INSERT IGNORE INTO - El Forum - 02-10-2012 [eluser]João Ramos[/eluser] I've had the same situation and used your approach. It's much cleaner using it on an active record than writing the whole SQL query. Thanks! |