title: Codeigniter Database Error Number 1048 Values show NULL even though they are NOT NULL
body: <p>I have situation where codeigniter shows database Error Number 1048. It seems Values NULL but when I try to check it usign <strong>var_dump($_POST)</strong> Values are not NULL.</p>
  
  <p><strong>Controller : Jurusan.php</strong></p>
  
  <pre><code>public function simpan()
  {
      $this-&gt;form_validation-&gt;set_rules('code','Kode','required|integer');
      $this-&gt;form_validation-&gt;set_rules('jurusan','Jurusan','required');
      $this-&gt;form_validation-&gt;set_rules('singkatan','Singkatan','required');
      $this-&gt;form_validation-&gt;set_rules('ketua','Ketua','required');
      $this-&gt;form_validation-&gt;set_rules('nik','NIK','required|integer');
      $this-&gt;form_validation-&gt;set_rules('akreditasi','Akreditasi','required');
  
      if($this-&gt;form_validation-&gt;run() == FALSE)
      {
          $isi['content'] = 'jurusan/form_tambahjurusan';
          $isi['judul'] = 'Master';
          $isi['sub_judul'] = 'Tambah Jurusan';
          $this-&gt;load-&gt;view('tampilan_home',$isi);
      } else {
          $this-&gt;model_security-&gt;getSecurity();
  
          $key = $this-&gt;input-&gt;post('code');
          $data['kd_prodi'] = $this-&gt;input-&gt;post['code'];
          $data['prodi'] = $this-&gt;input-&gt;post['jurusan'];
          $data['singkat'] = $this-&gt;input-&gt;post['singkatan'];
          $data['ketua_prodi'] = $this-&gt;input-&gt;post['ketua'];
          $data['nik'] = $this-&gt;input-&gt;post['nik'];
          $data['akreditasi'] = $this-&gt;input-&gt;post['akreditasi'];
  
          $this-&gt;load-&gt;model('model_jurusan');
          $query = $this-&gt;model_jurusan-&gt;getdata($key);
  
          if($query-&gt;num_rows()&gt;0)
          {
              $this-&gt;model_jurusan-&gt;getupdate($key,$data);
          } else {
              $this-&gt;model_jurusan-&gt;getinsert($data);
          }
  
          redirect('jurusan');
      }   
  }
  </code></pre>
  
  <p><strong>Model : model_jurusan.php</strong></p>
  
  <pre><code>class Model_jurusan extends CI_model {
      public function getdata($key)
      {
          $this-&gt;db-&gt;where('kd_prodi',$key);
          $hasil = $this-&gt;db-&gt;get('prodi');
          return $hasil;
      }
  
      public function getupdate($key,$data)
      {
          $this-&gt;db-&gt;where('kd_prodi',$key);
          $this-&gt;db-&gt;update('prodi',$data);
      }
  
      public function getinsert($data)
      {
          $this-&gt;db-&gt;insert('prodi',$data);
      }
  }
  </code></pre>
  
  <p><strong>Here is the error shown :</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/grKiG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/grKiG.jpg" alt="enter image description here"></a></p>
  
  <p><strong>Here is the database structure :</strong></p>
  
  <p><a href="https://i.stack.imgur.com/CZoLl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZoLl.jpg" alt="enter image description here"></a></p>