Welcome Guest, Not a member yet? Register   Sign In
database related problem
#1

[eluser]madhobi[/eluser]
if I autoload the library in config/autoload.php file it gives the following error.
"Unable to connect to your database server using the provided settings.

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

Line Number: 124"

This is my first php code and also first work with CI. Please anyone can help me.
#2

[eluser]toopay[/eluser]
Check your database setting, database.php under './application/config/'!
Make sure every input (database name, database username and password) valid.
#3

[eluser]InsiteFX[/eluser]
And also make sure that you create the database first!

InsiteFX
#4

[eluser]madhobi[/eluser]
yes, database name is correct. But I did not mention any username, password. In normal php file I can access the database. Is username and password mandatory?
#5

[eluser]John_Betong_002[/eluser]
If all else fails then dab this debug test code onto the end of:

// ./application/config/database.php
Code:
// /*
  echo '<pre>';
    print_r($db['default']);
  echo '</pre><br />';

  echo 'Connecting to database: ' .$db['default']['database'];

  $dbh=mysql_connect
  (
    $db['default']['hostname'],
    $db['default']['username'],
    $db['default']['password'])
    or die('Cannot connect to the database because: ' . mysql_error()
  );
  
  mysql_select_db ($db['default']['database']);
    
  echo '<br />Connected OK:';
    
// */
&nbsp;
&nbsp;
&nbsp;
#6

[eluser]InsiteFX[/eluser]
username and password would be the same that you used to create the database!

InsiteFX
#7

[eluser]danmontgomery[/eluser]
You can set autoinit to FALSE in config/database.php and the connection won't be made untill you call $this->db->initialize(). You would still need to set the username and password in config/database.php, though.
#8

[eluser]madhobi[/eluser]
Thanks a lot to all. U all are so kind. Problem solved.
I made the mistake by empty username and password.
thank u again. Smile




Theme © iAndrew 2016 - Forum software by © MyBB