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.''); ?>
<input type="submit" class="btn btn-success btn-sm" value='Save'>
<a style="margin-left:100px;" class="btn btn-danger btn-sm" href=""><i class="fa fa-trash fa-fw" style="margin-right:2px;"></i> Delete</a>
</div>
<!-- end database operational buttons ---------------------------------------------------------------------------------------->
<!-- content area -->
<!-- part details -->
<div class="row">
<div class="col-lg-10">
<div class="panel panel-default" style="padding-bottom:15px;">
<div class="panel-heading">
Part Details
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-pills">
<li class="active">
<a href="#home-pills" data-toggle="tab">Details</a>
</li>
<li>
<a href="#record-info-pills" data-toggle="tab">Record Info</a>
</li>
<li>
<a href="#run-info-pills" data-toggle="tab">Run Info</a>
</li>
<li>
<a href="#lot-info-pills" data-toggle="tab">Lot Info</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane fade in active" id="home-pills">
<div class="col-lg-6">
<h3>Part Details</h3>
<br />
<table class="tabledetail">
<tr>
<td><b>Chip Number</b></td>
<td><input type="text" name="chipNumber" value="<?php echo $p->chipNumber; ?>" /></td>
</tr>
<tr>
<td><b>Substrate Number</b></td>
<td><input type="text" name="subNumber" value="<?php echo $p->subNumber; ?>" /></td>
</tr>
<tr>
<td><b>Aperture</b></td>
<td><input type="text" name="aperture" value="<?php echo $p->aperture; ?>" /></td>
</tr>
<tr>
<td><b>Functional Elements</b></td>
<td><input type="text" name="elementsWorking" value="<?php echo $p->elementsWorking; ?>" /></td>
</tr>
<tr>
<td><b>Elements in Design</b></td>
<td><input type="text" name="elementsNumber" value="<?php echo $p->elementsNumber; ?>" /></td>
</tr>
<tr>
<td><b>Data Rate</b></td>
<td><input type="text" name="dataRate" value="<?php echo $p->dataRate; ?>" /></td>
</tr>
<tr>
<td><b>Box Location</b></td>
<td><input type="text" name="boxLocation" value="<?php echo $p->boxLocation; ?>" /></td>
</tr>
<tr>
<td><b>Geographic Location</b></td>
<td><input type="text" name="geographicLocation" value="<?php echo $p->geographicLocation; ?>" /></td>
</tr>
<tr>
<td><b>Package Type</b></td>
<td><input type="text" name="packageType" value="<?php echo $p->packageType; ?>" /></td>
</tr>
<input type="hidden" name="partID" value="<?php echo $p->partID; ?>" />
<input type="hidden" name="runID_FK" value="<?php echo $p->runID_FK; ?>" />
<input type="hidden" name="lotID_FK" value="<?php echo $p->lotID_FK; ?>" />
</table>
<br />
<table class="tabledetail">
<tr>
<td><b>Part Notes</b></td>
</tr>
<tr>
<td>
<textarea name="partNotes" rows="3" cols="80"><?php if ($p->partNotes) { echo $p->partNotes; } ?></textarea>
</td>
</tr>
<tr>
<td><b>Misc Notes</b></td>
</tr>
<tr>
<td>
<textarea name="miscNotes" rows="3" cols="80"><?php if ($p->miscNotes) { echo $p->miscNotes; } ?></textarea>
</td>
</tr>
<tr>
<td><b>Instructions</b></td>
</tr>
<tr>
<td>
<textarea name="instructions" rows="3" cols="80"><?php if ($p->instructions) { echo $p->instructions; } ?></textarea>
</td>
</tr>
</table>
</div>
<?php echo form_close(); ?>
Here is my controller...
Code:
public function update_part() {
$data = array (
'chipNumber' => $this->input->post('chipNumber'),
'subNumber' => $this->input->post('subNumber'),
'aperture' => $this->input->post('aperture'),
'elementsWorking' => $this->input->post('elementsWorking'),
'elementsNumber' => $this->input->post('elementsNumber'),
'dataRate' => $this->input->post('dataRate'),
//'lotCreatedOn' => time(),
//'lotCreatedBy' => get user from active dir),
'boxLocation' => $this->input->post('boxLocation'),
'cabinetLocation' => $this->input->post('cabinetLocation'),
'geographicLocation' => $this->input->post('geographicLocation'),
'dateShipped' => $this->input->post('dateShipped'),
'packageType' => $this->input->post('packageType'),
'packageIDNum' => $this->input->post('packageIDNum'),
'investigatePart' => $this->input->post('investigatePart'),
'partNotes' => $this->input->post('partNotes'),
'miscNotes' => $this->input->post('miscNotes'),
'instructions' => $this->input->post('instructions'),
'partUpdatedOn' => date("d/m/Y")
);
$this->load->model('model_data');
$this->model_data->update_part_data($data);
$this->load->view('part_attachment', $data);
}
and here is my model...
Code:
public function update_part_data($data){
$this->db->where('partID', $this->uri->segment(5));
$this->db->update('dev_db_parts', $data);
}
partUpdatedOn is the only field that gets updated corectly in the database
thank you for your help