Parse Error!

Hello, I just started using CodeIgniter yesterday and I have watched the tutorials and I'm pretty sure I've got the coding right but I get a parse error when I upload..

Here's the error;
Parse error: syntax error, unexpected $end in /home/hmdwebde/public_html/blog/system/application/controllers/blog.php on line 39

Any help?

I've looked at my blog.php but it looks fine, heres my blog.php;

class Blog extends Controller {
    function Blog()
    function index()
        $data['title'] = "My Blog Title";
        $data['heading'] = "My Blog Heading";
        $data['query'] = $this->db->get('entries');
        $this->load->view('blog_view', $data);

     function comments()
        $data['title'] = "My Comment Title";
        $data['heading'] = "My Comment Heading";
        $this->db->where('entry_id', $this->uri->segment(3));
        $data['query'] = $this->db->get('comment');
        $this->load->view('comment_view', $data);  
     function comment_insert()
         $this->db->insert('comments', $_POST);


Are there any other files you need to see?

Thanks In Advance,

Hi Hugo and welcome to the CI forums.

[quote author="Peejk" date="1258692032"]
class Blog extends Controller {

This { doesn't have a matching closing }

Also, don't bother with the closing ?> tags - they can cause all kinds of weird problems.

Now I get this error;
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/hmdwebde/public_html/blog/system/application/controllers/blog.php:41)

Filename: codeigniter/Common.php

Line Number: 356

404 Page Not Found
The page you requested was not found.

So what should I do, I can just go over the tutorial again I suppose.
I'm a newbie, I have absolutely no idea what I'm doing :down:


Hi Peejk - post code, whenever you make changes.

[quote author="Peejk" date="1258707985"]
Message: Cannot modify header information - headers already sent by (output started at /home/hmdwebde/public_html/blog/system/application/controllers/blog.php:41)

You either have a space before the <? or you still have the ?> tag in place. If it turns out you have the ?> tag still in play - after I pointed out you should get rid of it as it causes weird problems - you'll probably feel like a right goose.

(Okay, you might possibly have a different problem, but those two cause 99% of these errors.)

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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