Php code for connecting to a MySQL Database

Here is the Php code for connecting to MySQL Database

$mysql_hostname = "mysqlserver";
$mysql_user = "mysqlusername";
$mysql_password = "mysqlpassword";
$mysql_database = "mysqldatabase";
set_time_limit(6000);
$sn = mysql_connect($mysql_hostname, $mysql_user, $mysql_password);
mysql_select_db($mysql_database, $sn);


The last two lines are important as they connect to MySQL Database using Username,Password,hostname and Database

Here Mysqlserver,mysqlusername,mysqlpassword,mysqldatabase should be replaced by your own values

This entry was posted on Sunday, January 18th, 2009 at 10:38 am and is filed under SQL. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Post a Comment