我一直在尝试对我的 php 结果进行动态排序,但是由于某种原因,它什么也没做,如果我尝试更改下拉列表中的排序字段,什么也没有发生,我无法弄清楚.
这是php代码
$sortorder = "ASC";
$sortfield = "addon_name";
if(isset($_GET["sortorder"])) {
$sortorder = $_GET["sortorder"];
}
if(isset($_GET["sortfield"])) {
$sortfield= $_GET["sortfield"];
}
$small_statement = "`addons` WHERE addon_size='small' ORDER BY $sortfield $sortorder";
这是html代码
<select name="sortorder" onChange="MM_jumpMenu('parent',this,0)">
<option value="?sortorder=ASC">Ascending</option>
<option value="?sortorder=DSC">Descending</option>
</select>
<select name="sortfield" onChange="MM_jumpMenu('parent',this,0)">
<option value="?sortfield=addon_name">Name</option>
<option value="?sortfield=addon_rank">Rank</option>
</select></div><!---end browse_header--->
<div id="small" class="tab_content">
<?php
$browse_small_query = mysql_query("SELECT * FROM {$small_statement} LIMIT {$startpoint_small} , {$limit}");
while($row_small = mysql_fetch_assoc($browse_small_query)) : ?>
<?php extract($row_small);?>
<div class="addon_wrapper" onclick="location.href='addon_detail.php?eid=<?php print "$estate_id";?> &aid=<?php print "$addon_id";?>';"><div class="addon_header"><?php print "$addon_name";?><?php print "$addon_id";?></div><!---end addon_wrapper---><div class="addon_browse_image"></div><!---end addon_browse_image---></div><!---end addon_wrapper--->
<?php endwhile ?>
感谢您的任何帮助