Welcome Guest, Not a member yet? Register   Sign In
Basic Question for a newbie
#1

[eluser]deineMudder[/eluser]
Hello everyone,
i am totally new to CI.
I watched the video tutorials, which are impressive. doing the tutorials step by step on my own server seem to get me some problems already tho.
when i started to extend my controller with a db-query

Code:
$data['query'] = $this->db->get('user');
$this->load->view('login',$data);

it results in Fatal error: Call to a member function on a non-object .

now i havent made anything special at all, just following the video tutorial of "creating a blog in 20min". The scaffolding feature works nicely, tho if i try to connect on my own to the database it seems impossible to work. i was searching the forum already for over an hour to find a proper solution to my problem, but nothing seems to help.

linux server
php4
#2

[eluser]deineMudder[/eluser]
System: Linux 2.6.9-023stab044.1-smp #1 SMP Sat May 5 12:04:40 MSD 2007 i686
PHP Version 4.3.10-16
#3

[eluser]deineMudder[/eluser]
it seems i cant use any of the db core functions
i just tried

Code:
$dbs = $this->dbutil->list_databases();

foreach($dbs as $db)
{
    echo $db;
}

my whole function was
Code:
function user_authorize()
    {
        parent::Controller();


        $dbs = $this->dbutil->list_databases();

foreach($dbs as $db)
{
    echo $db;
}

        // Retrieve the user name and password from the login form
        $password   = $this->input->post('password', TRUE);
        $username   = $this->input->post('username', TRUE);

        //$this->load->database('default', TRUE);
        //$this->load->model('login_model','','default');
         $auth = $this->Login_model->check_user($username, $password);

        echo "USERNAME: ".$username."<br>";
        echo "Password: ".$password."<br>";

        $this->load->view('login',$data);

    }


i assume there is a general config/settings mistake on my installation Sad
please anyone give me a hint.
#4

[eluser]deineMudder[/eluser]
not much info in the logfile too

Code:
DEBUG - 2007-06-23 12:24:29 --&gt; Config Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Hooks Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Router Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Output Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Input Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2007-06-23 12:24:29 --&gt; URI Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Language Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Loader Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Helpers loaded: url, form
DEBUG - 2007-06-23 12:24:29 --&gt; Controller Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Session Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Validation Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Loader Class Initialized
DEBUG - 2007-06-23 12:24:29 --&gt; Helpers loaded: url, form
DEBUG - 2007-06-23 12:24:29 --&gt; Controller Class Initialized
#5

[eluser]Flayra[/eluser]
It's rather simple - you haven't loaded the Database library. Either load it in config/autoload.php or do $this->load->database();

Once that's done, all the functions should work properly.
#6

[eluser]deineMudder[/eluser]
aw, thx alot.
you made my day.
and sorry i asked such a newbie question.
works now Wink
#7

[eluser]Unknown[/eluser]
make sure you're not sorry for the newbie question.

you'd be sorry if you had <i>not</i> asked.

: )




Theme © iAndrew 2016 - Forum software by © MyBB