<?php
header("Content-type: text/html; charset=utf-8");
$mysqlhost="localhost";
$mysqluser="root";
$mysqlpasswd="123";
$mysqldb="testDB";
$mysqli = new mysqli($mysqlhost, $mysqluser, $mysqlpasswd, $mysqldb);
//檢查是否連線成功
if (mysqli_connect_errno()) {
printf("<p>抱歉,連線失敗", mysqli_connect_error());
$this->mysqli = FALSE;
exit();
}
else
{
printf("<p>恭喜,連線成功!");
}
$mysqli->close();
?>
Mysqli 有比較好嗎?
回覆刪除