![]() |
Error in documentation (Inserting into a database by setting object variables) - 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: Error in documentation (Inserting into a database by setting object variables) (/showthread.php?tid=3561) |
Error in documentation (Inserting into a database by setting object variables) - El Forum - 10-10-2007 [eluser]tmcw[/eluser] I'm following the user guide on a new project, and <a href=" http://ellislab.com/codeigniter/user-guide/general/models.html">this page</a> has the syntax Code: function insert_entry() For inserting an entry. Using something very similar to that seems to try to insert all of the inherited properties of Model, and thus throws an error. Code: function insert_run() Code: An Error Was Encountered Eh? Error in documentation (Inserting into a database by setting object variables) - El Forum - 10-10-2007 [eluser]ELRafael[/eluser] you don't have the _parent_name in the table. try to use print_r or var_dump in the $this. i use in another way. Code: // in some cases (almost), $this has more than the keys/values to insert in the table! Error in documentation (Inserting into a database by setting object variables) - El Forum - 10-10-2007 [eluser]Michael Wales[/eluser] It's a known error within the documentation and it will actually save your hide a lot of the time. You don't want to just go inserting an object into a database without absolutely knowing, 100%, what is contained within that object. Therefore, I always do something similar to this: Code: $insert->title = $this->input->post('title'); This way - you know exactly what you are putting into your database. Takes a bit more typing, but security usually does. |