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.
Now, whenever we need to connect to our database, we just include this line in our PHP file:
<?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()); ?>
You can learn more about including files, and connecting to MySQL from PHP in the other tutorials on our website.
//MySQL Database Connect include 'datalogin.php';