我正在使用此代码
$con = mysql_connect("***.***.**.**:3306","Username","Password") or die("Error:".mysqlerror());
//选择数据库
mysql_select_db("DBname", $con );
答案 0 :(得分:0)
您也可以使用PHP 5 Mysqli,如下所示:(OOP Style)
$mysqli = new mysqli ("localhost", "my_user", "my_password", "my_db");
if ($mysqli->connect_errno)
{
echo "ERROR";
}
if ($mysqli->query("SELECT * FROM USERS"))
{
echo "SUCESS";
}