On my local phpmyadmin, I have created two databases with the names:
- fast
- financialanalysisautodb
This is how they appear on the phpmyadmin:
From my php application I tried accessing the databases as below:
// Create connection
$fastdb = new mysqli("localhost", "root", "", "financialanalysisautodb") or die(mysql_error());
if ($fastdb->connect_error) {
die("Database connection failed: " . $fastdb->connect_error);
}
The above code works fine if I access financialanalysisautodb. However, if I try to access the "fast" db:
// Create connection
$fastdb = new mysqli("localhost", "root", "", "fast") or die(mysql_error());
if ($fastdb->connect_error) {
die("Database connection failed: " . $fastdb->connect_error);
}
I get the following error message:
Warning: mysqli::__construct(): (HY000/1049): Unknown database 'fast' in C:\xampp\htdocs\AutomatedFinancialAnalysis\fastlogin.php on line 19 Database connection failed: Unknown database 'fast'
Can someone help me solve this problem? Thank you in advance.