title: CodeIgniter - mysql while loop
body: <p>I am relatively experienced PHP developer.</p>
  
  <p>I have chosen the CodeIgniter framework. So far I have understood how it is used. Until now, I want to be able to do a while loop.</p>
  
  <p>Within my controller I have:</p>
  
  <pre><code>$this-&gt;load-&gt;model('Test');
  $data['result'] = $this-&gt;Test-&gt;getInfo();
  $this-&gt;load-&gt;view('index1', $data);
  </code></pre>
  
  <p>In my Model I have:</p>
  
  <pre><code>$result = mysql_query("SELECT * FROM users WHERE last_name='Hart'")or die(mysql_error());  
  $row = mysql_fetch_array( $result );    
  return $row;
  </code></pre>
  
  <p>And in my View:</p>
  
  <pre><code>echo $result[0];
  </code></pre>
  
  <p>However, this only outputs the first field within the first row found.</p>
  
  <p>Please could you help me with retrieving the information from a database - while loop.</p>
  
  <p>Does the while loop happen in the Model? Am I just echoing out the result correctly?</p>