Making a MySQL database connection with PHP


Where db_host, db_user, db_pass and db_name is the host, username, password and name for your database respectively.

General practice is to save the code in a separate file in the ‘includes’ folder and including it on the page where you need it.

<?php include("database.php") ?>