title: How to pass data from controller to models in codeigniter
body: <p>I passed parameter from view to controller via URL. Now I want to send it from controller to model so that I can use it to pick data from tables. Here is my code:</p>
  
  <p>controller:</p>
  
  <pre><code>function view(){
      if(isset($_GET['r'])) {
          $rank = $_GET['r'];
      }
  
      $rank=$this-&gt;uri-&gt;segment($rank);
      $this-&gt;load-&gt;model('names_rank');
      $data=$this-&gt;names_rank-&gt;get_names($rank);
      print_r($rank); 
  }   
  </code></pre>
  
  <p>model:</p>
  
  <pre><code>function get_names($rank){  
      $this-&gt;db-&gt;select('u.*,v.*');
      $this-&gt;db-&gt;from('unit_member u, Vyeo v');
      $this-&gt;db-&gt;where('v.fno = u.fno');
      $this-&gt;db-&gt;where('u.present = ""');
      $this-&gt;db-&gt;where('v.rank', $rank);
      $this-&gt;db-&gt;where('v.date_of_end="0000-00-00"');
      $query = $this-&gt;db-&gt;get();
      return $query-&gt;result_array();
  }
  </code></pre>
  
  <p>this is the result:</p>
  
  <blockquote>
    <p>A PHP Error was encountered Severity: Warning Message: Missing
    argument 1 for Names_rank::get_names(), called in
    C:\xampp\htdocs\unit\application\controllers\names.php on line 32 and
    defined</p>
  </blockquote>