![]() |
Active record question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Active record question (/showthread.php?tid=27248) |
Active record question - El Forum - 02-04-2010 [eluser]megabyte[/eluser] So with CodeIgniter's active record, you can do this: Code: $this->db->set('id', $id, FALSE); Add a third parameter. But if you use an array: Code: $data = array('id' => $id); How would you mimic this? Active record question - El Forum - 02-04-2010 [eluser]Shay Falador[/eluser] Really simple: Code: $this->db->set($data, null, FALSE); Just take a look at the method: Code: function set($key, $value = '', $escape = TRUE) Active record question - El Forum - 02-04-2010 [eluser]megabyte[/eluser] What I'm saying is that the only way to not escape data is using the set method. You can't set it to not escape a certain value if you do this: Code: $data = array( Its still going to escape the id Am I right? Active record question - El Forum - 02-04-2010 [eluser]Shay Falador[/eluser] Right. Insert was not really designed for this... It takes only 2 arguments... Active record question - El Forum - 02-25-2010 [eluser]Jason Tan Boon Teck[/eluser] I'm trying to build an insert statement, using set. For example, in the model: Code: ... And this is the result Code: A Database Error Occurred Somehow, some string values were not composed inside quotes, e.g. address, address_2, causing PostgreSQL to choke. What is the proper way to ensure each string item is in quotes? |