[eluser]Unknown[/eluser]
Thank you PascalKriete for the quick response. That worked great. I just wasn't aware of the return. Thanks for the warm welcome to the CodeIgniter community.
For future reference:
MODEL
Code:
function retrieve_members ()
{
$query = $this->db->query('SELECT id, firstName, lastName, memberNum, email FROM member');
return ($query->num_rows() >0) ? $query->result() : FALSE;
}
CONTROLLER
Code:
function index()
{
$this->load->database();
$this->load->model('CMS_model');
$data['include'] = 'control_panel';
$data['members'] =$this->CMS_model->retrieve_members();
$this->load->view('template', $data);
}
VIEW
Code:
echo "<table>";
echo "<tr><td>First Name</td><td>Last Name</td><td>Membership Number</td><td>Email</td></tr>";
foreach ($members as $row)
{
echo "<tr><td>";
echo $row->firstName;
echo "</td><td>";
echo $row->lastName;
echo "</td><td>";
echo $row->memberNum;
echo "</td><td>";
echo $row->email;
echo "</td></tr>";
}
echo "</table>";