如何从顶部列表中排除某些名称

This code displays a list of all the names that are stored in the database in the table "entries".

I have a list of 200 names. The top 20 is marked in green. Last 20 red. Others are blue.

$position=0;

$upit = mysql_query("SELECT * FROM entries ORDER BY votes DESC");
  //This is now an array of the data

while ($model = mysql_fetch_array($upit)) {
$position++;
$data = unserialize($model['data']);
$max = mysql_num_rows($upit);
$max = $max - 20;

if ($position < 21){
echo "  <font color=#008000> ".$position." )  ".$data[6]['value']."  ( ".$model[votes]." ) </font>";

} elseif ($position <= $max) {
echo "  <font color=#000080> ".$position." )  ".$data[6]['value']."  ( ".$model[votes]." ) </font>";

} else {
echo "  <font color=#FF0000> ".$position." )  ".$data[6]['value']."  ( ".$model[votes]." ) </font>";
}
}

This CODE displays a list in the following way

 1. Novak Djokovic (1342) 
 2. Rafael Nadal (1234) 
 3. Roger Federer (1002)
 4. Name 4 (990) 
 5. Name 5 (899) 
 6. ...

Now I want to out of list two names from the list but they are not deleted from the database. Each name has its own unique ID in the table "entries" a field called "entries_id".

For example, I want to Out of list Novak Djokovic whose "entries_id" is "150" and Roger Federes hose "entries_id" is "92"

Simply update your query accordingly

SELECT * FROM entries WHERE entries_id<>150 AND entries_id<>92 ORDER BY votes DESC

And you won't get those two records in your result even when they exist in database like you want.

Try this:

...
$count = 0;
while ($model = mysql_fetch_array($upit)) {
    $position++;
    $data = unserialize($model['data']);
    $max = mysql_num_rows($upit);
    $max = $max - 20;

    if (!($data[6]['value'] == 150 || $data[6]['value'] == 92)){
        $count++;
        if ($count< 21){
            echo "  <font color=#008000> ".$position." )  ".$data[6]['value']."  (".$model[votes]." ) </font>";
        } elseif ($count<= $max) {
            echo "  <font color=#000080> ".$position." )  ".$data[6]['value']."  ( ".$model[votes]." ) </font>";
        } else {
            echo "  <font color=#FF0000> ".$position." )  ".$data[6]['value']."  ( ".$model[votes]." ) </font>";
        }
    }
}