尝试测试循环在哪一行,如果它大于或等于六,请将 $TESTIMAGE 变量插入到 span 元素中以进行下一次迭代。
当我运行代码时,它会将变量插入第一行之后的所有内容中。
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";
}
}