ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

CodeIgniter App getting data from the wrong mySQL table?

October 07, 2008 5:13am

Subscribe [3]
  • #16 / Oct 07, 2008 7:36am

    Dave Blencowe

    28 posts

    Ok, problem seems to be fixed now I have added data in to the table.
    Bit weird to be honest…

  • #17 / Oct 07, 2008 7:47am

    xwero

    4145 posts

    And if you remove the comment again?

  • #18 / Oct 07, 2008 7:49am

    Dave Blencowe

    28 posts

    It display data from content_blog

  • #19 / Oct 07, 2008 7:59am

    xwero

    4145 posts

    What is the code of the comment view?

  • #20 / Oct 07, 2008 8:19am

    Dave Blencowe

    28 posts

    mdl_blog.php comments function

    function get_comments($id)
        {
            $this->db->order_by('id', 'desc');
            $this->db->where('post_id', $id);
            $comments = $this->db->get('content_test');
            
            return $comments->row_array();
        }

    blog.php Comments function

    function comments()
        {
            $this->load->view('template/default/header');
            
            $id = $this->uri->segment(3);    
            $get_blog = $this->mdl_blog->get_blog($id, '1');        
    
            $get_comments = $this->mdl_blog->get_comments($id);
    
            $this->load->view('blog/comments/main_view', $get_blog);
            $this->load->view('blog/comments/comments_view', $get_comments);
            $this->load->view('blog/comments/comments_add');
            $this->load->view('template/default/footer');
        }

    Comments_view.php

    
    									
  • #21 / Oct 07, 2008 9:11am

    xwero

    4145 posts

    I guess the subject, name and timestamp variables output is blog data, correct?

  • #22 / Oct 07, 2008 2:20pm

    Dave Blencowe

    28 posts

    Anything in the comments view is outputting comments, there is a separate view for blog data although the variables are very similar.

    main_view.php

    
    									
  • #23 / Oct 08, 2008 4:18am

    xwero

    4145 posts

    The variables you add to the blog view are stored so if they are not overwritten by variables passed on to the comments view variables they will be displayed.

    But the view for the comments you showed is only for one comment. If you make it a loop the problem should be solved.

  • #24 / Oct 08, 2008 10:43am

    Dave Blencowe

    28 posts

    Made the loop earlier and it works.
    Thank you very much for your time and consideration,
    Dave

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases