Trying to test which row the loop is on and if it's greater than or equal to six, plug the $TESTIMAGE variable into the span element for the next iteration.
When I run the code, it plugs the variable into everything following the first row.
While($row = mysql_fetch_array($result))
{
//assign variables
$title = $row['title'];
$url = $row['location'];
$image = "/waves/files/images/games/$title.png";
echo "
<span class='dropt'>
<a href=$url>$title</a>
<span class='$TESTIMAGE'>
<img src='$image'>
</span>
</span>
<br />
";
//Test to see which row we're on -- adjust image position
If (mysql_num_rows($result) >= 6)
{
$TESTIMAGE = "image_display_up";
}
}