PHP MySQL Database Connection Code
Thursday, August 27th, 2009 Blog by BrenigJust a simple little blog post. I wanted to put this out there for anyone who needs a simple connection code to get access to their database from a PHP script. Keep in mind this is for local host connect.
$host=”localhost”;
$username=”username for database”;
$password=”password for database”;
$databasename=”name of database”;
$dbh=mysql_connect (“$host”, “$username”, “$password”) or die (‘I cannot connect to the database because: ‘ . mysql_error());
mysql_select_db (“$databasename”);
hope this helps someone