select similar value from MySQL and order the result
Posted
by mathew
on Stack Overflow
See other posts from Stack Overflow
or by mathew
Published on 2010-05-15T07:54:19Z
Indexed on
2010/05/15
8:04 UTC
Read the original article
Hit count: 179
how do I order this result??
$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>";
}
© Stack Overflow or respective owner