Best approach to implement save method of model. - 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: Best approach to implement save method of model. (/showthread.php?tid=38632) |
Best approach to implement save method of model. - El Forum - 02-14-2011 [eluser]Unknown[/eluser] Hi! I have started new CI 2.0 project. And I wonder that is the best approach to implement save method of model? I thing there are at least 4 ways: 1 Code: class Brand extends CI_Model 2 Code: class Brand extends CI_Model 3 Code: class Brand extends CI_Model 4 Code: class Brand extends CI_Model Thanks for any advices/thoughts! Best approach to implement save method of model. - El Forum - 02-14-2011 [eluser]sikko[/eluser] You should avoid using $this->db->query() since codeigniter's db class has the functions to cover most of the queries. Code: class Brand extends CI_Model Fill your object in your controller, not in your model Code: $brand = new stdClass(); btw, this forum is not made for code, you should try to move your thread. |