• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Beginner : How to debug

This is my very first time to try CI. I tried to follow tutsplus video with the following scenarion:

Model (post.php):
class Post extends CI_Model {
function get_posts($num=20, $start=0) {
$this->db->select()->from('posts')->where('active',1)->order_by('date_added', 'desc')->limit($num,$start);
$query = $this->db->get();
return $query->result_array();

function get_post($postID){
$this->db->select()->from('posts')->where(array('active'=>1,'postID'=>$postID))->order_by('date_added', 'desc');
return $query->first_row('array');

Controller (posts.php):
class Posts extends CI_Controller{
function __construct(){

function index(){

function post($postID){

View (post.php):
&lt;?php if(!isset($post)) { ?&gt;
<p>The page was accessed incorrectly</p>
&lt;? } else { ?&gt;
&lt;? } ?&gt;

I can browse to localhost/posts and retrieve all posts. But when i click on read more (detail), i got:
Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.
Error 404

The url is : http://localhost/posts/post/1

How do I track this error? Thx for any help.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.