"insert" - SQL-Problem using the Active Record Class |
[eluser]Derek Jones[/eluser]
[quote author="NachoF" date="1242103997"]I see... so what do you recommend I do?[/quote] Well, there's no reason to send the entire class object to an insert/update query, and in fact would cause problems on all but the simplest of model classes. That example in the docs was likely written in haste, and should be modified so that others don't use it as a pattern. Rather, simply use a separate object or array that contains only the items you want, e.g. Code: $data = array('foo' => 'bar');
[eluser]pankaj[/eluser]
[quote author="NachoF" date="1242119426"]Yes, thats what I ended up doing.. thanks.[/quote] @Derek Jones thanks for explanation about $this object but I want you to see this Code: function insert_entry() in user guide at http://ellislab.com/codeigniter/user-gui....html#what this example is using $this object for inserting data. and I am sure this will not work. and this example should be removed from the user guide ---
[eluser]TheFuzzy0ne[/eluser]
That example should work fine, so long as it's called from within the model, and you have set the appropriate properties first. Controller: Code: $this->user_model->username = "TheFuzzy0ne"; Model: Code: function insert_user() Called from within the model, $this represents the model, not the CodeIgniter Super Object.
[eluser]pankaj[/eluser]
[quote author="TheFuzzy0ne" date="1242487511"]That example should work fine, so long as it's called from within the model, and you have set the appropriate properties first. Controller: Code: $this->user_model->username = "TheFuzzy0ne"; Model: Code: function insert_user() Called from within the model, $this represents the model, not the CodeIgniter Super Object.[/quote] this method is not working that is the main problem I am facing I have posted new thread for that. at http://ellislab.com/forums/viewthread/114514/P0/ |
Welcome Guest, Not a member yet? Register Sign In |