สามารถติดต่อฐานข้อมูลได้แล้วนะครับ วิธีการก็คือ หากใครเจอปัญหาอย่างผม
ทาง Host เขาจะมี ID PASS ให้ สำหรับ Login เข้าสู่ DirectAdmin กับฐานข้อมูล เขาจะให้สร้างเอาใหม่ ก็คือ ตั้งชื่อฐานข้อมูล และ รหัสผ่าน ชื่อฐานข้อมูลกับ กับ id ในการเข้าสู่ php myadmin นั้นคืออันเดียวกันครับ
งงไหมครับ
Code ครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$servername = "localhost";//ตรงนี้ให้ใส่เป็น localhost ไปเลยครับ ไม่ต้องแก้ไขอะไร
$username = "xxxxxcom_xxxxxx";//ตรงนี้เป็น ID เข้าสู่ php myadmin
$password = "xxxxxxxxx";//ตรงนี้เป็นรหัสผ่านที่เข้าสู่ phpmyadmin ครับ
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
</body>
</html>
จะเห็นได้ว่า ผมไม่ได้นำรหัสของ Host มาใช้นะครับ ต้องใช้เป็นรหัส ฐานข้อมูล หรือ php myadmin ครับ