For example, we can use the SQL code below to login to our MySQL database. Let's save this code in a file called datalogin.php.
<?php
// Connects to Our Database
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error());
?>
Now, whenever we need to connect to our database, we just include this line in our PHP file:
//MySQL Database Connect
include 'datalogin.php';
You can learn more about including files, and connecting to MySQL from PHP in the other tutorials on our website.

