strange model behaviour - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: strange model behaviour (/showthread.php?tid=23446) |
strange model behaviour - El Forum - 10-11-2009 [eluser]joeizang[/eluser] hi guys, sorry I have something strange happening between a model and controller. Basically I would like to capture comments from the users of the application so having written my code, i get the following the error: <div id="content"> <h1>A Database Error Occurred</h1> <p>You must use the "set" method to update an entry.</p> </div> but I am not updating, I am just inserting into my db into a table called comments: Here is my code, is there something here that I am not seeing? (Model) Code: function createcomment($data) Controller Code: function addcomments() Thanks for being great guys strange model behaviour - El Forum - 10-11-2009 [eluser]InsiteFX[/eluser] Code: $array = array('name' => $name, 'title' => $title, 'status' => $status); Enjoy InsiteFX strange model behaviour - El Forum - 10-11-2009 [eluser]joeizang[/eluser] hey thanks for the reply, I made the change to my model, I also realized that this is written about in the documentation so i read it and still it's saying the same thing. h1>A Database Error Occurred</h1> <p>You must use the "set" method to update an entry.</p> I wanted to say that I wrote another model, but did not have this problem. I don't know what I am doing wrong, but can is there anything else I should be doing? Code: function createcomment($data) strange model behaviour - El Forum - 10-11-2009 [eluser]BrianDHall[/eluser] Code: function createcomment($data) Not sure why you call insert twice, so try changing as above. strange model behaviour - El Forum - 10-11-2009 [eluser]joeizang[/eluser] Thanks BrainDHall, I guess it's just plenny caffine and long hours. Many thanks |