![]() |
Trying to update database with textarea... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Trying to update database with textarea... (/showthread.php?tid=299) |
Trying to update database with textarea... - alexandervj - 11-19-2014 I'm trying to update my database with a textarea (name=postNote). But whenever I press the save button it saves a "0" in the request_notes field in the database no matter what I type in. Here is my view... Code: <?php Code: public function saveNotes(){ Code: function isNote(){ RE: Trying to update database with textarea... - Rufnex - 11-19-2014 for the update stuff you need a third parameter : the id or matching key of the dataset: PHP Code: $this->db->update('mytable', $data, "id = 4"); Look here at the documentation: http://www.codeigniter.com/userguide3/database/query_builder.html#this-db-update RE: Trying to update database with textarea... - alexandervj - 11-19-2014 I think thats what the $this->db->where('submit_time', $this->uri->segment(3)); does right above the $this->db->update('apps_request_notes', $data); Do you think maybe its because I didn't name my anchor and give any form action or method for my textarea? RE: Trying to update database with textarea... - Rufnex - 11-19-2014 Sorry . dont saw the where part, your right ;o) For the Form stuff you have to sumit the form by an submit event: Code: <form action="/..." method="post"> You can't submit a form by an html anchor. RE: Trying to update database with textarea... - alexandervj - 11-19-2014 I figured it out. It was because I had no form_open, form_close, and I needed to change the anchor to a form_submit. Thanks RE: Trying to update database with textarea... - Rufnex - 11-19-2014 Your welcome. |