使用 Codeigniter 更新 MySql 中的数据不起作用
Updating data in MySql with Codeigniter does not work
MySql 数据库未使用在视图中输入的新数据进行更新。遵循 MVC 架构。
My Controller :
public function saveEdit() {
$this->load->helper('form');
$id = $this->uri->segment(3);
$save=array(
'userstory' => $this->input->post('userstoryarea'),
'datetocomplete' => $this-> input->post('datecomplete'),
'name'=> $this->input->post('developer')
);
$this->load_userStory->saveEdited($id,$save);
$this->viewUStory();
}
My Model
public function saveEdited($id,$save){
$this->db->where('devid', $id);
$this->db->update('developer', $save);
}
在某些地方,我调用了一些 javascript 方法,这些方法将 return 显示一些值。
My View
<?php foreach ($story as $UserStory): ?>
<form method="post" action="<?php echo base_url() ."addstories/saveEdit"?>" >
<p> Select Devoloper to add :
<select class="form-control" id="developer" name ="developer" style="width:200px;"> </p>
<?php
$val2 = $row['name'];
foreach($developers as $row)
{
echo '<option value="'.$row->full_name.'" >'.$row->full_name.'</option>';
}
?>
</select>
<p>
<p>
Select a date to complete the project : <i>
<input type="date" id="datecomplete" name ="datecomplete" value="<?php echo $UserStory->datetocomplete;?>" onchange="calculate()">
</i> </p>
<p>
<input type="textarea" name="userStory" id="userStory" value=" <?php echo $UserStory->userstory; ?> ">
</p>
<input type="submit" name ="dsubmit" value="Save" id="submit">
</form>
<?php endforeach; ?>
像我传递 $id 一样传递第三个值 id
<form method="post" action="<?php echo base_url() ."addstories/saveEdit/".$id?>" >
MySql 数据库未使用在视图中输入的新数据进行更新。遵循 MVC 架构。
My Controller :
public function saveEdit() {
$this->load->helper('form');
$id = $this->uri->segment(3);
$save=array(
'userstory' => $this->input->post('userstoryarea'),
'datetocomplete' => $this-> input->post('datecomplete'),
'name'=> $this->input->post('developer')
);
$this->load_userStory->saveEdited($id,$save);
$this->viewUStory();
}
My Model
public function saveEdited($id,$save){
$this->db->where('devid', $id);
$this->db->update('developer', $save);
}
在某些地方,我调用了一些 javascript 方法,这些方法将 return 显示一些值。
My View
<?php foreach ($story as $UserStory): ?>
<form method="post" action="<?php echo base_url() ."addstories/saveEdit"?>" >
<p> Select Devoloper to add :
<select class="form-control" id="developer" name ="developer" style="width:200px;"> </p>
<?php
$val2 = $row['name'];
foreach($developers as $row)
{
echo '<option value="'.$row->full_name.'" >'.$row->full_name.'</option>';
}
?>
</select>
<p>
<p>
Select a date to complete the project : <i>
<input type="date" id="datecomplete" name ="datecomplete" value="<?php echo $UserStory->datetocomplete;?>" onchange="calculate()">
</i> </p>
<p>
<input type="textarea" name="userStory" id="userStory" value=" <?php echo $UserStory->userstory; ?> ">
</p>
<input type="submit" name ="dsubmit" value="Save" id="submit">
</form>
<?php endforeach; ?>
像我传递 $id 一样传递第三个值 id
<form method="post" action="<?php echo base_url() ."addstories/saveEdit/".$id?>" >