php - updating /changing a value in database using codeigniter -


iam developing using codeigniter , have managed post id number , phone number table named "offers" both fields int, when try update phone number corresponding specific id keep getting following error

unknown column 'mysubmit' in 'field list'

update offers set phnenum = '078444', mysubmit = 'submit form' idnum = '12'

filename: c:\xampp\htdocs\project\system\database\db_driver.php

i have listed controller , model , view below

newoffer/controller

     class newoffer extends ci_controller {   function addoffer() {  //if form 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());    }     }  }  ?> 

offer_model

  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 post value data array      unset($data['idnum']); // unset unnecessary values     $this->db->where('idnum', $idnum)->update('offers' ,$data);    return true; }    }    ?> 

the view // please enter details new offer

        <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 -->     ?> 

public function upddata($data) {               $idnum = $data['idnum'];               $offers_data = array("phnenum" => $data['phnenum']);               unset($data['idnum']); // unset unnecessary values               $this->db->where('idnum', $idnum)->update('offers' ,$offers_data );              return true; } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -