Select Page

Quick mysql_connect php script

The below script is a quick PHP script that connects to a mysql database to test connectivity.

<html>
<body>
<?
$host = "xxx.xxx.xxx.xxx";
$username = "username";
$password = "password";

        /* Connecting, selecting database */
        $conn = mysql_connect($host, $username, $password)
        or die("Could not connect");
        /* select the database */
        mysql_select_db("user") or die("Could not select database <I>user</I> Database<br>");
?>
</body>
</html>