关于对数据库里某表的一栏内容进行排序的问题

来源:百度知道 编辑:UC知道 时间:2024/06/19 06:58:39
<?php
//get the top 5
mysql_query("set names 'GBK'");
$query = mysql_query("SELECT * FROM `characters` ORDER BY `exp` DESC ");

//rank= 0 for ranking numbers
$rank = "0";

//start ing the table before the loop
?>
<b>TOP <?php echo $Top5; ?> 荣耀之榜</b></br></br>
<table cellpadding="1">
<tr>
<td><span class="content"><div align="center">排名</div></span></td>
<td><span class="content"><div align="center">玩家昵称</div></span></td>
<td><span class="content"><div align="center">等级</div></span></td>
<td><span class="content"><div align="center">职业</div></span></td>
</tr>
<?php
/

PHP的啊...要在Limit之前先ORDER DESC一下,看你这代码应该是按等级排名.mysql_query()函数要加载的语句应该这样$job_query = mysql_query("SELECT * FROM `phpTitanMS_jobs` WHERE `id` = '" . $data['job'] . "' ORDER BY `等级` DESC LIMIT 5") or die("Error:查询数据库出错!");

在要排序的后面加上 order by 列名 desc