I am trying to create a simple blog with a beginner's knowledge of Codeigniter. I have been able to loop all the blog posts in the index page. But when i try to open a single post it doesn't show up. Even though things seem correct to me so far.
Model:
function get_post($postID) {
$this->db->select()->from('posts')->where(array('active'=>1, 'postID'=> 'postID'))->order_by('date_added', 'desc');
$query = $this->db->get();
return $query->first_row('array');
}
Controller:
function post($postID) {
$data['posts']= $this->post->get_post($postID);
$this->load->view('post',$data);
}
View:
<?php
if (!isset($post)) { ?>
<p>This was accessed incorrectly</p>
<?php } else { ?>
<h2><?= $post['title']; ?></h2>
<p><?= $post['post']; ?></p>
<?php } ?>
The single page shows "This was accessed incorrectly". Here is the blog link blog link. Please help me.