I am relatively experienced PHP developer.
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.
Within my controller I have:
$this->load->model('Test');
$data['result'] = $this->Test->getInfo();
$this->load->view('index1', $data);
In my Model I have:
$result = mysql_query("SELECT * FROM users WHERE last_name='Hart'")or die(mysql_error());
$row = mysql_fetch_array( $result );
return $row;
And in my View:
echo $result[0];
However, this only outputs the first field within the first row found.
Please could you help me with retrieving the information from a database - while loop.
Does the while loop happen in the Model? Am I just echoing out the result correctly?