Welcome Guest, Not a member yet? Register   Sign In
autoload the database class issue
#1

[eluser]Mavrick[/eluser]
Hello Every one....


I am new to Codeigniter and looking for some help here... I have IIS installed on port 80. And my wamp localhost is accessible to me via port 81 (i.e. localhost:81). Now the problem is when I try to load my database through my controller...
Code:
$this->load->model('DBModel', '', TRUE);
$this->DBModel->insertURLMetaData();
And my DBModel is yet empty except for
Code:
class DBModel extends CI_Model {
        
        function __construct() {
            parent::__construct();
            echo 'Model Constructor';
        }
        
        function insertURLMetaData() {
            echo '<br /> insertURLMetaData';
        }
        
    }
Though I had configured the database.php file in config folder which is :
Code:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost:81';
$db['default']['username'] = 'root@localhost';
$db['default']['password'] = '';
$db['default']['database'] = 'db';
$db['default']['dbdriver'] = 'mysql';
$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']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;


/* End of file database.php */
/* Location: ./application/config/database.php */
Can any one tell me here what am I doing wrong? Cause I can smell something fishy here. Confusedhut:

Thanks in advance,
#2

[eluser]OliverHR[/eluser]
Hostname refers to host of your Database server not your http server.

try with
Code:
$db['default']['hostname'] = 'localhost';
#3

[eluser]Mavrick[/eluser]
Thanks for the reply ...

I did what you asked me to do... And Thats What it came up with.... I guess Driver have an issue...


A Database Error Occurred
Unable to connect to your database server using the provided settings.

Filename: D:\wamp\www\Mavrick\system\database\DB_driver.php

Line Number: 124
#4

[eluser]Rolly1971[/eluser]
for the db password i believe is should be just: root, not: root@localhost.
#5

[eluser]Mavrick[/eluser]
Thanks Rolly! You made my day! :-)
#6

[eluser]Rolly1971[/eluser]
glad i could help but i just noticed that i have an error in my post LOL

should have said db_username not db password lol.




Theme © iAndrew 2016 - Forum software by © MyBB