我想在 html 表的标题中对来自 mysql 数据库的数据进行排序。我写了这段代码:
$username = $_SESSION['username']; // gets the username
echo "<table class='normal_table'>";
$new_word = mysql_query("SELECT * FROM new_word WHERE username='$username'");
$new_word2 = mysql_query($new_word);
echo "
<tr>
<th><a href='test.php?sort=cz'>Czech:</a></th>
<th><a href='test.php?sort=en'>English:</a></th>
<tr>";
if ($_GET['sort'] == 'cz')
{
$new_word .= " ORDER BY cz";
}
elseif ($_GET['sort'] == 'en')
{
$new_word .= " ORDER BY en";
}
while($new_word2 = mysql_fetch_array($new_word)){
echo "
<tr>
<td> ".$new_word2['cz']."</td>
<td>".$new_word2['en']."</td>
</tr>
"; }
echo "</table>";
但是屏幕上没有出现任何数据:(我做错了什么?