Thursday, March 22, 2012

Connect to a MySQL Database PHP

Open Connection


 $con = mysql_connect("localhost","dbUserName","p@assword");
 if (!$con){die('Could not connect: ' . mysql_error());}
 
//some code


Close Connection

$con = mysql_connect("localhost","dbUserName","p@assword");
if (!$con){die('Could not connect: ' . mysql_error());}

// some code
mysql_close($con);

No comments:

Post a Comment