Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter A Database Error Occurred

Tags:

codeigniter

Can someone help me?

I am a beginner and trying to make wearing CodeIgniter authentication, but when I try to make an error like this

A Database Error Occurred

Error Number: 1046

No database selected

SELECT * FROM (`user`) WHERE `user_username` = 'amanda' AND user_passwordMD5("12345") =

Filename: C:\xampp\htdocs\codeigniter\system\database\DB_driver.php

Line Number: 330

thanx

like image 270
Revoir Hz Avatar asked Apr 05 '14 06:04

Revoir Hz


2 Answers

please make sure you have setup database configuration in application/config/database.php file

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'my_database';
like image 159
Laukik Patel Avatar answered Oct 27 '22 05:10

Laukik Patel


Check the database.php file in application/config/

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'mypassword';
$db['default']['database'] = 'my_database'; // here is the database selection
like image 39
ReNiSh AR Avatar answered Oct 27 '22 05:10

ReNiSh AR