有人能帮助我吗?
我是初学者并尝试使用CodeIgniter身份验证,但是当我尝试制作这样的错误时
发生数据库错误
Error Number: 1046
未选择数据库
SELECT * FROM (`user`) WHERE `user_username` = 'amanda' AND user_passwordMD5("12345") =
Filename: C:\xampp\htdocs\codeigniter\system\database\DB_driver.php
Line Number: 330
感谢名单
答案 0 :(得分:3)
请确保您在application / config / database.php文件中设置了数据库配置
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'my_database';
答案 1 :(得分:1)
检查 application / config /
中的 database.php 文件$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'mypassword';
$db['default']['database'] = 'my_database'; // here is the database selection
答案 2 :(得分:0)
打开文件application/config/database.php
文件并更改以下行:
$db['default']['dbdriver'] = 'mysql';
要:
$db['default']['dbdriver'] = 'mysqli';
这一天转移到mysqli
。
答案 3 :(得分:0)
查询期间与MySQL服务器的连接丢失 行号:337
答案 4 :(得分:-1)
$config['hostname'] = "localhost";
$config['username'] = "username";
$config['password'] = "password";
$config['database'] = "database";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";