Error in documentation (Inserting into a database by setting object variables) |
[eluser]tmcw[/eluser]
I'm following the user guide on a new project, and <a href=" http://ellislab.com/codeigniter/user-gui...odels.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?
[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!
[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. |
Welcome Guest, Not a member yet? Register Sign In |