phpMyAdmin登入畫面,當然您也可以透過網址來登入管理資料庫:「http://127.0.0.1/phmyadmin」或是「http://localhost/phpmyadmin」,登入名稱為「root」,密碼部分請留空,然後點擊﹝執行﹞。
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "contact";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT name, phone, mobile FROM contact";
$result = $conn->query($sql);
if ($result != null) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "Name: " . $row["name"]. " - Phone: " . $row["phone"]. " " . $row["mobile"]. "
";
}
} else {
echo "0 results";
}
$conn->close();
?>
改變伺服器的樣子
在上面捷徑中丟一個檔
留言列表