使用查询

时间:2016-10-01 19:17:29

标签: php html mysql sql character-encoding

好吧所以我有一个数据库,其中包含一些不同国家的数据,如资本,大陆,人口。用我的语言,亚洲大陆被翻译成亚西。但是当我通过查询导入数据时,它会显示如下:Azi

<!DOCTYPE html>
<html>
  <head>
    <title>Opdracht 36</title>
    <meta charset="utf-8" />
  </head>
  <body>
    <table>
      <tr>
        <strong>
          <th>land_id</th>
          <th>land</th>
          <th>hoofdstad</th>
          <th>werelddeel</th>
          <th>inwoners</th>
        </strong>
      </tr>
      <?php 
        $servername = "localhost";
        $username = "root";
        $password = "";
        mysql_connect($servername, $username, $password);
        mysql_select_db("Enigma");
        $query = "SELECT * FROM landen ORDER BY werelddeel";
        $result = mysql_query($query);
        while ($row = mysql_fetch_array($result)) 
        {
      ?>
      <tr>
        <td><?php echo $row["land_id"]; ?></td>
        <td><?php echo $row["land"]; ?></td>
        <td><?php echo $row["hoofdstad"]; ?></td>
        <td><?php echo $row["werelddeel"]; ?></td>
        <td><?php echo $row["inwoners"]; ?></td>
      </tr>
      <?php
        }
      ?>
    </table>
  </body>
</html>

0 个答案:

没有答案