[eluser]faxtion[/eluser]
Got the following code but does not display anything in view, neither does it give me and error, any help appreciated
Code:
Controller
class Parts extends Controller {
function index() {
echo 'Hello World!';
}
function view() {
$this->load->model('Parts_model');
$data['parts'] = $this->Parts_model->get_parts();
$this->load->view('parts_view', $data);
}
}
?>
Code:
Model
<?php
class Parts_model extends Model {
function Parts_model()
{
// Call the Model constructor
parent::Model();
}
function get_parts() {
//$query = $this->db->query('SELECT title FROM parts');
$query = $this->db->get('parts', 10);
return $query->result();
}
}
?>
Code:
View
<html>
<head>
<title>Rally Parts Auction</title>
</head>
<body>
<h3>Parts</h3>
<ul>
<?php foreach($parts as $part):?>
<h4><?=$part['postid']?></h4>
<p><?=$part['title']?></p>
<p><?=$part['description']?></p>
<p><?=$part['category']?></p>
<p><?=$part['image']?></p>
<p><?=$part['image1']?></p>
<p><?=$part['image2']?></p>
<?php endforeach;?>
</ul>
</body>
</html>