आप MySQL के between
का उपयोग कर सकते हैं और limit
इसके लिए खंड:
$range = 5; // you'll be selecting around this range.
$min = $rank - $range;
$max = $rank + $range;
$limit = 10; // max number of results you want.
$query = "select * from table where rank between $min and $max limit $limit";