My sql connection in php

Untitled Document

Making connection with mysql database in php is a very easy job.In php mysql_connect() function opens connection , It takes at least three arguments host (here localhost ), username and password.First argument is host name, it may be an IP address or domain name like Second argument is username for mysql and third one is password for mysql connection. Here it is assumed that mysql is on same host where this script is running, therefore we are using localhost.


{ //connection is opened
echo "Connection established<br/>";

{ //otherwise give error
echo mysql_error();