Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function on a non-object
#1

[eluser]Ornis[/eluser]
I got stuck with an error: Fatal error: Call to a member function on a non-object in / ... application/models/zug_model.php on line 15

I load the model in the controller and call the function getSimple() :
<?php

class Vogelkarte extends Controller {

function Vogelkarte()
{
parent::Controller();
$this->css = $this->config->item('css');
$this->js = $this->config->item('js');
$this->load->model(array('Zug_model'));
}

function get_it() {
$data['artenauswahl'] = $this->Zug_model->getSimple('artenliste',
array('id','art_de'));
var_dump($data['artenauswahl']);
}
?>

The Model looks like this
<?php
class Zug_model extends Model {

/**
* Konstruktor
*/
function Zug_model() {
parent::Model();
}


function getSimple($table = '',
$fields = array()
) {
$this->db->from($table);
$this->db->select($fields);
return $this->db->get();
}
}
?>
Why do I loose the $this-db object?

I'm currently working with php 4.4.9. Thanks.


Messages In This Thread
Fatal error: Call to a member function on a non-object - by El Forum - 03-15-2010, 03:09 AM
Fatal error: Call to a member function on a non-object - by El Forum - 03-15-2010, 03:16 AM
Fatal error: Call to a member function on a non-object - by El Forum - 03-15-2010, 03:55 AM
Fatal error: Call to a member function on a non-object - by El Forum - 03-15-2010, 04:52 AM
Fatal error: Call to a member function on a non-object - by El Forum - 03-16-2010, 02:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB