我正在使用 codeIgniter 进行开发,并且我设法简单地将 ID 号码和电话号码发布到名为“offers”的表中,这两个字段都是 INT,但是当我尝试更新与特定 ID 对应的电话号码时,我不断收到以下错误
“字段列表”中的未知列“mysubmit”
UPDATE offers
SET phneNum
= '078444', mysubmit
= '提交表格' WHERE idNum
= '12'
文件名:C:\xampp\htdocs\project\system\database\DB_driver.php
我在下面列出了我的控制器、模型和视图
newOffer/控制器
class newOffer extends CI_Controller {
function addOffer() {
//if the form is submitted
$this->load->view("check");
$this->load->model("offer_model");
if ($this->input->post('mysubmit')) {
$this->offer_model->entry_insert();
}
}
function updateOffer (){
$this->load->view("check");
$this->load->model("offer_model");
if ($this->input->post('mysubmit')) {
// $this->offer_model->upddata();
$this->offer_model->upddata($this->input->post());
}
}
}
?>
报价模型
class offer_model extends CI_Model{
public function entry_insert(){
$data = array(
'idNum' => $this->input->post('idNum'),
'phneNum' => $this->input->post('phneNum'),
);
$this->db->insert('offers',$data);
}
public function upddata($data) {
$data=array();
$idNum = $data['idNum'];
$data=$this->input->post(); //get all post value to data array
unset($data['idNum']); // unset unnecessary values
$this->db->where('idNum', $idNum)->update('offers' ,$data);
return true;
}
}
?>
视图 // 请输入新报价的详细信息
<label for="ID Number">ID Number: <span class="required">*</span></label>
<input type="text" name="idNum" id="idNum" placeholder="Please enter ID Number/>
<label for="phone Number">Phone Number:</label>
<input type="text" name="phneNum" id="phneNum " placeholder="Please enter phone Number"/>
<fieldset class="submit_field">
<?php echo form_submit('mysubmit', 'Submit Form'); ?>
</fieldset>
</div><!-- end of form div -->
?>