my code below will echo the position of the user if the number($nm) fallbetween the range so let say i have $nm = 10,4,3,3,1 respectively the position will be(staff,staff, staff,marketer, staff) instead of(marketer,sta ff,staff,staff, staff) how can i arrange so that marketer come first(marketer, staff,staff,sta ff,staff).
Code:
$query = "SELECT DISTINCT username,num FROM user ORDER BY num DESC LIMIT 5";
$result = mysql_query ($query) or die('query error');
while( $line = mysql_fetch_assoc($result)){
$um = $line[username];
$nm = $line[num];
echo "name:$um";
if($nm <= 50){
echo "Position: president";
}else if($nm <= 40){
echo "Position: vice";
}else if($nm <= 30){
echo "Position: manager";
}else if($nm <= 20){
echo "Position: marketer";
}else if($nm <= 10){
echo "Position: staff";
}
Comment