PHP Easy Most Database Connection

by on February 24th, 2008

Setting up a database connection can be a difficult task. Search Google and the scripts you will find will amaze you. These are lengthy and boring. Here is the easy most method to create a dbconnection for PHP and mysql.

Always write code both for Online and Local usage. Comment the code which is not being used. Also use siteurl variable and store website root path in it. It comes very very handy in times. We have to use many times website name inside the pages. Now you can save this code in a file named like dbcon.php or whatever you like and include this file in php pages where you want to use dbconnection by this.

Here you are done.Another very simple code for dbconnection if you like, I am writing it here.

This easy way to connect from mysql database through PHP will give a message if the connetion is not established.

One Review

  1. Alexander says:

    This is one of the best sites I have ever found. Thanks!!! Very nice and informal. I enjoy being here.