I have two databases on mysql server 'application' and 'test'. I am trying to connect to 'application' db using the following code
<?php
$link = mysqli_connect('127.0.0.1:3360','root','','application');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
?>
This is giving me the following error:
Warning: mysqli_connect(): (HY000/1049): Unknown database 'application' in C:\xampp\htdocs\ServerScripting.php on line 2
Fatal error: Uncaught Error: Call to undefined function mysql_error() in C:\xampp\htdocs\ServerScripting.php:4 Stack trace: #0 {main} thrown in C:\xampp\htdocs\ServerScripting.php on line 4
Whereas when I tried to connect to 'test' database it worked giving:
Connected successfully
I am using XAMPP server. I checked the permissions for each database and all the users are granted with complete access. I don't understand why this is happening.