Welcome Guest, Not a member yet? Register   Sign In
[fixed]
#1

[eluser]Unknown[/eluser]
The problem is fixed!
The answer is: I didn't know that you have to change the autoload file.
The autoload libaries array. You need to put in the database there. If you use the database.

Hey, i'm new with framework. And this one looks very nice.
Now i was trying. With tutorials and the user guide. But i wasn't getting far.

If i connect to my Database by a model. And then load the model in a controller. So i can view my database content. I get errors.


My model code: (filename: web.php)
Code:
class Web extends CI_model {

function __construct() {

        parent::__construct();
    }

function get_web_title() {

  $q = $this->db->get('settings');
  return $q->result();
  
}

}

My controller code: (filename: site.php)
Code:
class Site extends CI_Controller {

function __construct() {
        parent::__construct();
    }

public function index() {
  $this->load->model('Web');
  $data['query'] = $this->Web->get_web_title();
  
  $this->load->view('header_view', $data);
  $this->load->view('menu_view');
  $this->load->view('site_view');
  $this->load->view('footer_view');
  
}

}

The errors i get:
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Site::$db

Filename: core/Model.php

Line Number: 51
And
Code:
Fatal error: Call to a member function get() on a non-object in C:\wamp\www\win-oortjes\application\models\web.php on line 12

Maybe it is a simple mistake, but i can't find it. I over look it al a couple off times. But can't find the exact problem

Thank you!
Marijn[/b]




Theme © iAndrew 2016 - Forum software by © MyBB