below is the output I'm seeing along with my code. There are 11425 items in
the database, many of each of these possible values for $i[4], however
you'll see from my Output that the $iiscount variable is the only one being
incremented and it is getting incremented for every row in the table. Can
anyone see anything I'm doing incorrectly? The data in this column in the
table is formatted as TEXT. Thanks in advance for any help you can provide.
=)
11425
0
0
0
0
0
0
0
____________________________________________
$query = "SELECT * FROM table";
$result = mysql_query($query) or die(mysql_error());
$iiscount = 0;
$cfcount = 0;
$nlbcount = 0;
$srcount = 0;
$sacount = 0;
$rebootcount = 0;
$apccount = 0;
$othercount = 0;
while($i = mysql_fetch_row($result)) {
if ($i[4] = "IISRESET") {
$iiscount = $iiscount + 1;
} elseif ($i[4] = "CF Restart") {
$cfcount = $cfcount + 1;
} elseif ($i[4] = "NLB STOP IISRESET") {
$nlbcount = $nlbcount +1;
} elseif ($i[4] = "Service Restart") {
$srcount = $srcount + 1;
} elseif ($i[4] = "Restart System Attendant") {
$sacount = $sacount + 1;
} elseif ($i[4] = "Reboot") {
$rebootcount = $rebootcount + 1;
} elseif ($i[4] = "APC Reboot") {
$apccount = $apccount + 1;
} elseif ($i[4] = "Other") {
$othercount = $othercount + 1;
}
}
echo $iiscount, "<br>";
echo $cfcount, "<br>";
echo $nlbcount, "<br>";
echo $srcount, "<br>";
echo $sacount, "<br>";
echo $rebootcount, "<br>";
echo $apccount, "<br>";
echo $othercount, "<br>";
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php