<?php
$hostname="db2.example.com";
$user = "user";
$password = "password";
$link = mysql_connect("$hostname","$user","$password");
if (!$link) { die('Could not connect to MySQL: ' . mysql_error()); }
echo 'Connection OK';
$dbname = "dbai";
$selected = mysql_select_db("$dbname", $link) or die("could not open db". mysql_error());
mysql_close($link);
?>
Thursday, August 20, 2009
PHP Test mysql connection