• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Undefined property: Blog::$db

#11
[eluser]Unknown[/eluser]
it works $autoload['libraries'] = array('database'); in autoload.php file..

#12
[eluser]woran[/eluser]
thx fixed

#13
[eluser]Unknown[/eluser]
$autoload['libraries'] = array('database')

Worked for me. THANKS

#14
[eluser]felixk[/eluser]
Code:
$autoload['libraries'] = array('database');
I've tried that, but I'm still getting an error message.

I've also tried
Code:
$autoload['core'] = array('database');
But same error there.

I don't know what to do :S

Please help me someone! Smile

#15
[eluser]garymardell[/eluser]
felixk what error message are you getting exactly?

#16
[eluser]enko[/eluser]
Hi guys I have pretty much same problem Sad.

This is my database configuration:

$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "booking";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['active_r'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

This is in autoload.php
$autoload['libraries'] = array('database');

And I am getting this error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: BookingCalendar::$db

Filename: controllers/bookingCalendar.php

Line Number: 38

It seams that db is not loaded properly.

If I use something like this it works:

$this->CI =& get_instance();
$this->CI->load->database("", FALSE, TRUE);

Thanks!
$this->CI->db->cache_off();

#17
[eluser]enko[/eluser]
It seams that i forgot to call this: $this->load->database();

It works now!

#18
[eluser]Unknown[/eluser]
Quote:Check if this is set to true in your database config file. As far as I know db->get is an active record thing, so it needs to be set to use it.

$db['default']['active_r'] = TRUE;
You can also auto load the db for each page by setting it in the autoload.php

/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your system/application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/

$autoload['libraries'] = array('database')

Works fine, Thanx. Big Grin

#19
[eluser]parifuture[/eluser]
can some1 post the answer 4r the same que?

I am getting this error in the apache error log
[Mon Jun 13 09:55:03 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to a member function query() on a non-object in /home/parikshit/workspace/Webpurify/application/models/profane_model.php on line 17

this is my code

Code:
<?php

class Profane_model extends CI_Model {
    
    function getdata() {
        $q = $this->db->get('tags');
        
        if($q->num_rows() > 0) {
            foreach($q->result() as $row) {
                $data[] = $row;
            }
            return $data;
        }
    }
    
    function putdata($var) {
        $q = $this->db->query("INSERT INTO `sys_tag`.`tags`(`id` ,`s_tag`, `profane`)VALUES (NULL , '$var', 'F')");
        return 1;
    }
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.