<?php
// exampleデータベースにfield1, field2を持つtable1テーブルを作成済みの前提
// データベース接続情報
$url = "localhost";
$user = "root";
$password = "";
$database = "example";
// データベース接続処理
$connect = mysql_connect($url,$user,$password) or die("can't connect");
$db = mysql_select_db($database,$connect) or die("can't Select database");
$sql = "SELECT * FROM table1";
$result = mysql_query($sql, $connect) or die("can't submit SQL");
?>
<html>
<head>
    <title>Test Connection from PHP to MySQl</title>
</head>
<body>
<h1>テーブルの中身</h1>
<?php
    while ($row = mysql_fetch_assoc($result)) {
        echo "<p>";
        echo htmlspecialchars($row["field1"]);
        echo "<br />";
        echo htmlspecialchars($row["field2"]);
        echo '</p>';
    }
    mysql_free_result($result);
    mysql_close($connect) or die("can't closed");
?>
</body>
</html>