![]() |
using active record - 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: using active record (/showthread.php?tid=39455) |
using active record - El Forum - 03-10-2011 [eluser]ann91[/eluser] Hello everyone... i have a question when we use the active record class, should we use "return" like this Code: return $this->db->insert('mytable', $data); or Code: $sql = "INSERT INTO ". $this->table ." (comment_id,name,url,comment) VALUES ('null','". $data["name"] ."','". $data["url"] ."','". $data["comment"] ."')"; given the differences both of them.. thanks before using active record - El Forum - 03-10-2011 [eluser]InsiteFX[/eluser] Hi ann91, The first one should be fine, all it will return is the $sql. InsiteFX using active record - El Forum - 03-11-2011 [eluser]JoostV[/eluser] You could also return the insert ID, which is more useful info than the SQL Code: public function insert ($data){ using active record - El Forum - 03-11-2011 [eluser]ann91[/eluser] Hello InsiteFX, ok i'll try it...thank you.. JovostV: that's it oke..thank you.... |