Welcome Guest, Not a member yet? Register   Sign In
Blog problem
#1

[eluser]opel[/eluser]
Hello I have been following the Blog video tutorial and have most of it working apart from one thing, the mcomment_insert function.

Can someone please tell me where I am going wrong if they have time ?

Code:
<?
class Blog extends Controller {
    
    function Blog ()
    {
        parent::Controller();
        
        $this->load->helper('url');
        $this->load->helper('form');
    
    }
    
    
    function index()
        {
            $data['title'] = " Blog";
            $data['heading'] = " Blog index";
            $data['query'] = $this->db->get('blogEntries');
            $this->load->view('blog_view', $data);
        }
    
    
    function comments()
        {
            $data['title'] = " Blog Comments";
            $data['heading'] = " blog Comments";
            $this->db->where('entry_id', $this->uri->segment(3));
            $data['query'] = $this->db->get('blogComments');
            
            $this->load->view('comment_view', $data);
        }
    
    function comment_insert()
     {
            $this->db->insert('blogComments', $_POST);
            
            redirect('blog/comments/'.$_POST['entry_id']);
        }
    
}
?>

I have pasted my controller code below and the working file is at :

Test Blog

THe insert and display are all working its just when I go to submit a new comment I get an error although the comments do sunbmit to the DB successfully?




Theme © iAndrew 2016 - Forum software by © MyBB