Database connection example in PHP and MySQL

This tutorial shows an example with commonly used functions on how to connect to MySQL database using PHP. I have used here mysqli_* function to connect the database. I have also written here some most commonly used functions to reduce the efforts.

Create config.php file which holds some common database and other configurations parameters


Most commonly used function are put in a database.php file


Usage example


Please leave a comment if you have any query.

Soumitra Roy Sarkar

I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Twitter Facebook  Google Plus Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *