Skip to content

MySQL Connect

Before accessing the data in a database, you must open a connection to the database. In php, this is done by mysql_connect().


$con = mysql_connect('host', 'username', 'password') or

// when using in localhost
$con = mysql_connect('localhost', 'root', '') or die(mysql_error());

// To select a particular database
mysql_select_db("db_name",$con) or die(mysql_error());


<< Back

MySql Create

  1. Hi,

    Excellent.Nice article thanks for sharing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: