I really didn't know which category to put this in so I apologize now for any inconvenience caused, etc.

I have installed XAMPP for Mac on my computer, and it's installed fine, I get the 'Welcome to XAMPP' page when I go to http://localhost/, I can access phpMyAdmin, etc. the installation is fine. I've made a new database in phpMyAdmin called store as it will be a database for an online store, I've also made a user and assigned full control on that database at the moment. I'm doing this all locally because I haven't got a host yet by the way, oh and by the way Apache, MySQL and FTP are all running. So I've got a config.php file where I try to connect to the database in phpMyAdmin, I've put in the code to connect to it:

If I run a basic PHP file which just echos the text hello! it works perfectly fine, it was also in the same directory which showed it was working.

It's telling me it can't find the database I believe, so i'm stuck because I can't connect to the database. Does anyone out here know how I would connect to the database I made in phpMyAdmin, which is hosted locally using XAMPP? I would like to connect to it using PHP.Thank you in advance. Dan.

This is rather embarrassing, I just noticed I had a spelling error in the file name that I saved the config.php file I created, well not a spelling error I named it configuration.php. Please ignore this thread.

mysql_connect("HOST","USERNAME","PASSWORD") or die ("Could not connect to mysql server.");mysql_select_db("DATABASE_NAME") or die ("Could not connect to database.");

Then insert your server url where it says HOST, your mysql server username where it says USERNAME, and insert your mysql password where it says PASSWORD.On the following line where it says DATABASE_NAME, replace it with the database you'd like to connect to.

It is important you keep all the quotes in the string.

The 'or die()' function will display that message if any error occurs connecting to the mysql server or database.

I tried to connect to MySQL database the same way u did...but while running the php file i type localhost/test.php instead of localhost/student/test.php.....and i get the following output:Success! Connection to database student establishedbut when i tried localhost/student/test.php it gives me the following error message:Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.