title: CodeIgniter - Sending array from model to controller to page
body: <p>I am trying to pass the array to the view page and put the items in a listbox/dropdown. Where am I going wrong in this code?</p>
  
  <p>Model</p>
  
  <pre><code>public function get_suppliers(){
          $type = "SUPPLIER";
          $this-&gt;db-&gt;where('usertype', $type);
          $query = $this-&gt;db-&gt;get('users');
          foreach ($query-&gt;result() as $row){
              $results = array(
                  'userid' =&gt; $row-&gt;userid,
                  'firstname' =&gt; $row-&gt;firstname,
                  'lastname' =&gt; $row-&gt;lastname,
                  'company' =&gt; $row-&gt;company
              );
  
          }
          return $results;
      }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>$this-&gt;load-&gt;model('user_model');
  $data['supplier']= $this-&gt;user_model-&gt;get_suppliers();
  $this-&gt;load-&gt;view('include/header.php');
  $this-&gt;load-&gt;view('addvehicle_view', $data);
  $this-&gt;load-&gt;view('include/footer.php');
  </code></pre>
  
  <p>View</p>
  
  <pre><code>&lt;?php
    if(isset($supplier)){
        foreach ($supplier as $info){
        echo'&lt;option value="' . $info-&gt;userid . '"&gt;' . $info-&gt;company . ' - ' . $info-&gt;lastname . ', ' . $info-&gt;firstname . '&lt;/option&gt;';
      }
    }
    ?&gt;
  </code></pre>