A Database Error Occurred - codeigniter -
i got error :
unable connect database server using provided settings. filename: c:/xampp/htdocs/soheil/system/database/db_driver.php line number: 436
but when add below code inside database.php
prints ok :
echo '<pre>'; print_r($db['default']); echo '</pre>'; echo 'connecting database: ' .$db['default']['database']; $dbh=mysql_connect ( $db['default']['hostname'], $db['default']['username'], $db['default']['password']) or die('cannot connect database because: ' . mysql_error()); mysql_select_db ($db['default']['database']); echo '<br /> connected ok:' ; die( 'file: ' .__file__ . ' line: ' .__line__);
my config :
$db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => '', 'password' => '', 'database' => 'soheil', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => false, 'db_debug' => (environment !== 'production'), 'cache_on' => false, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => false, 'compress' => false, 'stricton' => false, 'failover' => array(), 'save_queries' => true );
are put username
on database? maybe root
user
$db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'soheil', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => false, 'db_debug' => (environment !== 'production'), 'cache_on' => false, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => false, 'compress' => false, 'stricton' => false, 'failover' => array(), 'save_queries' => true );
hope help.
Comments
Post a Comment