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.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.