我有一个 MySQL 查询,我试图在单击链接时动态排序。
我的链接看起来像这样
<form action="topics.php" method="get" class="form">
<label class="label">Order Table By</label>
<li><a href="topics.php?sort=ID">ID</a></li>
<li><a href="topics.php?sort=Title">Title</a></li>
<li><a href="topics.php?sort=TAGS">Tags</a></li>
<li><a href="topics.php?sort=VIEWS">Views</a></li>
</form>
MySQL 查询如下所示:
<?php
$order = mysql_real_escape_string($_GET['sort']);
$topics = mysql_query("SELECT topic_id AS 'ID', topic_head AS 'Title',
topic_tags AS 'TAGS', topic_views AS 'VIEWS',
FROM forum_topics
WHERE topic_id > 0 ORDER BY '$order' DESC") or die (mysql_error());
当我单击上面的任何链接时,没有任何反应。没有显示错误,没有进行排序。问题可能出在哪里?谢谢