Cant figure out why my database isnt updating... |
I'm a noob, I cant figure out why my database isnt updating. Here is my view...
Code: <?php echo form_open('dev_database/update_part/'.$l->lotID.'/'.$r->runID.'/'.$p->partID.''); ?> Here is my controller... Code: public function update_part() { and here is my model... Code: public function update_part_data($data){ partUpdatedOn is the only field that gets updated corectly in the database thank you for your help
There could be a number of reasons for this to happen.
In your view, you close a div after opening your form, but the div wasn't opened inside the form. The browser could decide that your form should be closed at this point, which would mean that all of the fields in your form are not included when you submit. Since 'partUpdatedOn' is one of the only fields which is not set by $this->input->post(), I wouldn't be surprised if this was the case (or if you're using some JavaScript to submit your page and not submitting the data properly). You're also passing three parameters to the controller's method according to the form_open() call, but you aren't processing those parameters in your controller. Instead of calling $this->uri->segment(5) in your model, you should retrieve this field in the controller and pass it to your model (either as another argument or within $data). Pulling this data in at the controller also gives you a chance to make sure you have the ID before you move along to updating the data. Some of the fields you're setting in the controller ('cabinetLocation', 'dateShipped', 'packageIDNum', and 'investigatePart') are not included on the form, so you should probably check whether those fields exist before setting their values in $data. Are you using the update_part() method only to perform updates, or is it being used to load the form initially, too?
Thanks for all the great advice, I will look into this and let you know what I find out
|
Welcome Guest, Not a member yet? Register Sign In |