如何訂購此結果?從MySQL中選擇類似的值並命令結果
$range = 5; // you'll be selecting around this range.
$min = $rank - $range;
$max = $rank + $range;
$limit = 10; // max number of results you want.
$result = mysql_query("select * from table where rank between $min and $max limit $limit");
while($row = mysql_fetch_array($result))
{
echo $row['name']." - ".$row['rank']."<br>";
}
請使用「101010」-Icon格式化您的代碼。 – Simon 2010-05-15 07:57:06
是不是應該是ORDER BY? – 2010-05-15 07:59:07