CodeIgniter Forums

Full Version: Problems with Database connectivity using odbc Message: Undefined property: CI_Loader::$db
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Not really sure what's going on. I can connect to the db through straight
Quote:Message: Undefined property: CI_Loader::$db

Filename: corpadmin/v_finduser.php

Line Number: 20

This is in my view page so i could test it.

/* line 20 */    $query = $this->db->query('select TOP 10 * from tb_people;');
    print_r ($query);    

    if ($query->num_rows() > 0){
               foreach ($query->result() as $row) {
                  echo $row->username;
                  echo $row->firstname;
                  echo $row->lastname;

and from my database.php

$db['default']['hostname'] = "hostname or I've tried my freeTDS DSN";
$db['default']['username'] = "musername";
$db['default']['password'] = "ASLDFJASLDF";
$db['default']['database'] = "DBNAME";
$db['default']['dbdriver'] = "odbc";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
$db['default']['port'] = "1433";

El Forum

config -> autoload.php
$autoload['libraries'] = array('database');