Connecting to a MySQL database with PHP
In this tutorial, i will tell, how to connect to an existing MySQL database with an existing username and password.
For the first, we need the database and the credentials for it. If you are using a free web hosting service with PHP and MySQL support, you already have this information.
If you have a web server installed with PHP and MySQL, you have to create a database and a username. Since this is not part of this tutorial i will talk about it in another post.
Now, it’s time to get connected. We will create the db.inc.php file: