[eluser]Chad Crowell[/eluser]
In my Model:
Code:
<?php
class Information_model extends Model {
function Information_model()
{
parent::Model();
}
function get_faq_topics() {
$query = $this->db->get('faq_topics');
return $query->result();
}
}
?>
In my Controller:
Code:
<?php
class Information extends Controller {
function Information() {
parent::Controller();
$this->load->model('Information_model');
}
function index() {
}
function faq() {
$data['result'] = $this->Information_model->get_faq_topics();
$this->load->view('information/faq', $data);
}
}
?>
In my View:
Code:
<body>
<h1>Hello</h1>
<?php
foreach($result as $row) {
echo '<p>'.$row['question'].'</p>';
}
?>
</body>
When I didn't have the model involved, it worked just fine. When I move the foreach loop to the model, it outputs the questions. As is, I get the h1 Hello /h1 but nothing beyond that. Somehow I am doing something simple wrong. This always happens and I never get farther than my first query in CI before I quit and outsource the project... help!