title: how to get last insert id after insert query in codeigniter
body: <p>I'm having problem with my controller, I return the the last id I've inserted in the model</p>
  
  <pre><code>public function insert_cropsci($question_data) {    
      $this-&gt;db-&gt;insert('cropscience_bank', $question_data);
      $questionid =$this-&gt;db-&gt;insert_id();
      return $questionid;
  }
  </code></pre>
  
  <p>but don't know how to get the id(id only) in my controller</p>
  
  <p>My Controller:</p>
  
  <pre><code>switch ($subject) {
      case 1:
          $this-&gt;load-&gt;model('insertquestion_model');
          $this-&gt;insertquestion_model-&gt;insert_cropsci($question_data);
          //I don't know what to do here to get the id(id only)
      break;
  }
  </code></pre>
  
  <p>need some help.</p>