Welcome Guest, Not a member yet? Register   Sign In
Constructor error?
#2

[eluser]CroNiX[/eluser]
It must be outdated. We use php5's __construct() for constructors now.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {
  //The constructor
  public function __construct() {
      parent::__construct();
  }
  public function index()
  {
    $query = $this->db->query('');
    $this->load->view('main/index');
  }
}

But the main error you are seeing is because you used "parent::Controller();" instead of "parent::CI_Controller();", but that's moot if you use the new construct above. Please see the user guide for Controllers (this is mentioned at the bottom)


Messages In This Thread
Constructor error? - by El Forum - 05-21-2012, 07:59 AM
Constructor error? - by El Forum - 05-21-2012, 11:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB