Loop does not work as expected
Posted: Tue Oct 01, 2002 3:56 pm
Hi guys, I was hoping someone could take a look at this and point out the problem (if there is one... )
I'm writing a little web app to display the top ten viruses as reported by Trend Micro. I want to have a small color coded icon appear next to each virus to represent it's risk factor (gray = low, yellow = medium, red = high). Each virus's risk factor is stored in an array callled $risk. I want the loop to assign the appropriate icon for the risk factor. However, the loop always returns blank.gif for the icon. The only time blank.gif should be returned is if there is no risk factor recorded for the virus. Here's the code:
Does anyone see any reason this won't work? I can't see it, but I'm fairly new to PHP, so it's entirely possible I just overlooked something.
Thank in advance,
AUaero
I'm writing a little web app to display the top ten viruses as reported by Trend Micro. I want to have a small color coded icon appear next to each virus to represent it's risk factor (gray = low, yellow = medium, red = high). Each virus's risk factor is stored in an array callled $risk. I want the loop to assign the appropriate icon for the risk factor. However, the loop always returns blank.gif for the icon. The only time blank.gif should be returned is if there is no risk factor recorded for the virus. Here's the code:
Code: Select all
<?php
$j = 0;
while ($j <= 9) {
if ($riskї$j] == "low") {
$statusї$j] = "images/gray.gif";
} elseif ($riskї$j] == "medium") {
$statusї$j] = "images/yellow.gif";
} elseif ($riskї$j] == "high") {
$statusї$j] = "images/red.gif";
} else {
$statusї$j] = "images/blank.gif";
}
$j++;
}
?>Thank in advance,
AUaero