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

Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.