Slashdot

Pages

Friday, June 4, 2010

Database Connection

connection.php


<?php
function db_connection_open()
{
$servername='localhost'; // Your MySql Server Name or IP address here
$dbusername=''; // Login user id here
$dbpassword=''; // Login password here
$dbname=''; // Your database name here
$link=mysql_connect ("$servername","$dbusername","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
return($link);

}
?>

No comments:

Post a Comment