Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I am trying a simple code igniter hello world tutorial but keep getting this error and don't know why.

Parse error: syntax error, unexpected T_CLASS in C:\xampp\htdocs\loxxbylisa\application\controllers\helloworld.php on line 3

<? php

    class HelloWorld extend CI_Controller {

    public function index(){
            $this->load->view('helloworld');
        }

    }

?>

I am running it in XAMPP and my helloworld.php in views folder is just the text "hello world". Any suggestions?

share|improve this question

The only thing that jumps out at me right now is you have a space between your opening

class HelloWorld extends CI_Controller

Notice the "s" at the end of extend. Should be extends. http://php.net/manual/en/keyword.extends.php

share|improve this answer

Please use this code it will work for you.. In controller ...you have use wrong spelling of extend...it should be extends

<?php

    class HelloWorld extends CI_Controller {

        public function index(){
            $this->load->view('helloworld');
        }

    }

?>

Create a view in the views with the name helloworld.php

share|improve this answer
    
Yes I have fixed that but the problem still remains. – user1427318 May 31 '12 at 14:30
    
have you used my code...?? – Pramod May 31 '12 at 15:04
    
the problem was the space after php. – user1427318 May 31 '12 at 16:13
    
ohk.....I have removed that error too in mycode....:) – Pramod May 31 '12 at 16:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.