title: Codeigniter: You must use the "set" method to update an entry
body: <p>I am trying to insert data using a submitted form. Data is entered properly in the database, but I'm doing API also for mobile. If <code>is_api</code> parameter is received, I'm doing <code>jsone_encode</code>. The following is the code:</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>public function send_request(){
              if($this-&gt;input-&gt;post('submit')){        
                  $user_data['data'] = array( 
                      'user_id'                =&gt;  1,
                      'sender_name'            =&gt;     $this-&gt;input-&gt;post('sender_name'),
                      'sender_location'        =&gt;     $this-&gt;input-&gt;post('sender_location'),
                      'sender_mobile'          =&gt;     $this-&gt;input-&gt;post('sender_mobile'),
                      'receiver_name'          =&gt;     $this-&gt;input-&gt;post('reciever_name'),
                      'receiver_location'      =&gt;     $this-&gt;input-&gt;post('reciver_location'),
                      'receiver_mobile'        =&gt;     $this-&gt;input-&gt;post('reciver_location'),
                      'request_type'           =&gt;     $this-&gt;input-&gt;post('request_type'),
                      'is_urget'              =&gt;     0,
                  );
  
              }
              $result = $this-&gt;user_model-&gt;send_request($user_data);
               if($result){
                  $this-&gt;result_set['message'] = 'Data entered ';
                  $this-&gt;result_set['status']= 1;
               }
                  if( $this-&gt;input-&gt;post('is_api') == 1){
                      echo json_encode($this-&gt;result_set);
                      die();
                  }
           }
  </code></pre>
  
  <p><strong>Model:</strong> </p>
  
  <pre><code>public function send_request($data){
          $this-&gt;db-&gt;insert('parcel_requests',$data['data']);
          return true;
       }
  </code></pre>
  
  <p>When I check <code>hurl.it</code> for API, I get this error and response:</p>
  
  <blockquote>
    <p><h1>A Database Error Occurred</h1>
          <p>You must use the "set" method to update an entry.</p>
          <p>Filename: /home/foldername/public_html/parcel/models/user_model.php</p>
          <p>Line Number: 21</p></p>
  </blockquote>
  
  <p>This is line number 21:</p>
  
  <pre><code>    $this-&gt;db-&gt;insert('parcel_requests',$data['data']);
  </code></pre>
  
  <p>Now data is entered properly, but <em>not converted to json</em>. I need your help to sort out this issue, thanks!</p>