I would like to add some filtering controls on my homepage so they look like this:
- Queue (1)
- Development (2)
- Underway (8)
- Complete (1)
I have working so far:
- Print the category name with ()
- Successfully loop through the first element and print the correct value
It seems to fail after the second element? If I am to get an error I would have expected to reach my trigger error statement but I am not?
Notice: Undefined offset: 1 in C:\wamp\www\ab-tests\index.php on line 36
<?php
$fArr = array('Queue','Development','Underway','Complete');
for ($i = 0; $i < count($fArr); $i++)
{
$fSQL = @mysql_query("select count(*) as tally from experiments where status = '$fArr[$i]' group by status");
if ($fSQL)
{
$fCount = mysql_fetch_array($fSQL);
echo "<p>" . $fArr[$i] . " (" . $fCount[$i] . ")" . "</p>";
}
else
{
trigger_error("<p>Unable to show filter counter at this time.</p>");
}
}
?>
Could anybody advise?