title: update data in codeigniter
body: <p>my code update is not working. i have some code in controller</p>
  
  <pre><code>function update($id) {
      $this-&gt;load-&gt;model("Model_mahasiswa");
      $data['nim']=$_POST['nim'];
      $data['nama']=$_POST['nama'];
      $data['alamat']=$_POST['alamat'];
      $result=$this-&gt;Model_mahasiswa-&gt;edit($id, $data);
      if($result){
          header("location: http://localhost/si_akademik/index.php/mahasiswa/");
      }
  }
  </code></pre>
  
  <p>and in modal code</p>
  
  <pre><code>public function edit($id, $data)
  {
      $this-&gt;db-&gt;where('id', $id);
  
      $result = $this-&gt;db-&gt;update('mahasiswa', $data); 
  
      return $result;
  }
  </code></pre>
  
  <p>but error: Call to a member function edit() on a non-object
  can you help me solve this problem?</p>