Welcome Guest, Not a member yet? Register   Sign In
Working with CI, MVC
#4

[eluser]jecrs[/eluser]
Of course i already have a table for comments on blog - "blog_comment"
I can already fetch for the comments when a user clicks on a particular blog with this code below(controller).
Code:
function comment(){
        // $this->load->form_validation();
        $blog_id = $this->uri->segment(3);

        $this->form_validation->set_rules('comment_name','Mentor', 'required');
        $this->form_validation->set_rules('comment_text','Content', 'required');

        $data['title'] = 'Welcome to CI';
        $data['header'] = 'Sample Blog Application...';
        $data['action'] = site_url('blogs/addComment/'.$this->uri->segment('3'));
        $data['blog'] = $this->blogsModel->getById($blog_id)->row();
        $data['blog_comment'] = $this->blogsModel->getCommentById($blog_id);

        $this->load->view('blogComment',$data);
    }

My problem would be on the index page were in there are many id involve when querying all those posted blog.
I want to know the logic on how to fetch all those blogs at the same time count the comments accompanied with each blog? (I can actually do this easily using native php)


Messages In This Thread
Working with CI, MVC - by El Forum - 03-30-2011, 12:50 AM
Working with CI, MVC - by El Forum - 03-30-2011, 04:03 AM
Working with CI, MVC - by El Forum - 03-30-2011, 09:27 AM
Working with CI, MVC - by El Forum - 03-30-2011, 07:25 PM
Working with CI, MVC - by El Forum - 03-31-2011, 04:28 AM
Working with CI, MVC - by El Forum - 03-31-2011, 07:41 PM
Working with CI, MVC - by El Forum - 03-31-2011, 08:11 PM
Working with CI, MVC - by El Forum - 03-31-2011, 10:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB