PHP仅显示来自数据库的单个结果

So I've been working on a small system which involves codes which is used for a user to redeem them for some sort of reward.

So far I have this script in PHP and HTML: http://pastebin.com/UUsEKpev

It's only showing one result which you can see here, I want it to display multiple results in a table going down showing all results.

<?php

$yn;
mysql_connect("localhost", "root", "password") or die(mysql_error());
mysql_select_db("mcv") or die(mysql_error());

$result = mysql_query("SELECT * FROM Codes")
or die(mysql_error());  

$row = mysql_fetch_array( $result );
// Print out the contents of the entry 

if ($row['Used'] == 1) {
    $yn = "Yes";
}
else{
    $yn = "No";
}

?>

<html>
<head>
    <title>Minecraft Codes</title>
    <style type="text/css">

    tbody {
        display: table-row-group;
        vertical-align: middle;
        border-color: inherit;
    }

    tr {
        display: table-row;
        vertical-align: inherit;
        border-color: inherit;
    }

    th {
        border: 1px solid #C3C3C3;
        padding: 3px;
        vertical-align: top;
        width: 20%;
        background-color: #E5EECC;
    }

    table.reference {
        background-color: white;
        border: 1px solid #C3C3C3;
        border-collapse: collapse;
        width: 50%;
    }

    table.reference td {
        border: 1px solid #C3C3C3;
        padding: 3px;
        vertical-align: top;
        width: 20%;
    }

    table, th, td, input, textarea {
        font-size: 100%;
    }

    body, p, h1, h2, h3, h4, table, td, th, ul, ol, textarea, input {
        font-family: verdana,helvetica,arial,sans-serif;
    }

    </style>
</head>

<body>
    <center>
        <br />
        <h1><u>Minecraft Server VIP Codes</u></h1>
        <br />

        <table class="reference">
            <tr>
                <th>Code</th>
              <th>Used?</th>
          </tr>
          <?php echo "<tr><td>".$row['Code']."</td><td>".$yn."</td></tr>"; ?>
        </table>
    </center>
</body>
</html>

Well yes, you call mysql_fetch_row() only a single time, thus you only retrieve a single row. You have to wrap that into a loop that is executed as many times as there are rows.

There are millions of examples on the internet that you can learn from...

Your problem is that you are only fetching one row:

$row = mysql_fetch_array( $result );

That line fetches the current row of the result set. You want to do that in a loop:

$rows = array();
while ($row = mysql_fetch_array($result)) {
    $rows[] = $row;
}

If you can please avoid using the mysql_ functions, they are deprecated, see the giant warning here and read this

<table class="reference">
    <tr>
        <th>Code</th>
        <th>Used?</th>
    </tr>

    <?php while ($row = mysql_fetch_array($result)): ?>
    <?php 
        if ($row['Used'] == 1) {
            $yn = "Yes";
        }
        else{
            $yn = "No";
        }
    ?>
    <tr>
        <td><?php echo $row['Code']; ?></td>
        <td><?php echo $yn; ?></td>
    </tr>
    <?php endwhile; ?>
</table>