I need help in zeroing a hash out.
Below is the code
<?php
do
{
$myhash1[$row_get_Jan1['Originator_Submitter']][] = $row_get_Jan1['Status'];
$myhash01[$row_get_Jan1['Originator_Submitter']][] = $row_get_Jan1['Avg_Daily_Alarms'];
}
while ($row_get_Jan1 = mysql_fetch_assoc($get_Jan1));
do
{
$myhash1a[$row_get_Jan2['Originator_Submitter']][] = $row_get_Jan2['Status'];
$myhash01a[$row_get_Jan2['Originator_Submitter']][] = $row_get_Jan2['Avg_Daily_Alarms'];
}
while ($row_get_Jan2 = mysql_fetch_assoc($get_Jan2));
do
{
$myhash1b[$row_get_Jan3['Originator_Submitter']][] = $row_get_Jan3['Status'];
$myhash01b[$row_get_Jan3['Originator_Submitter']][] = $row_get_Jan3['Avg_Daily_Alarms'];
}
while ($row_get_Jan3 = mysql_fetch_assoc($get_Jan3));
arsort ($myhash1);
arsort ($myhash01);
arsort ($myhash1a);
arsort ($myhash01a);
arsort ($myhash1b);
arsort ($myhash01b);
foreach ($myhash1 as $key1 => $value1)
{
$count1 = count($value1);
$count_open1=0;
for ($i=0; $i<$count1; $i++)
{
if ($value1[$i] == 0)
{
$count_open1++;
}
if ($value1[$i] == 1)
{
$count_open1++;
}
}
foreach ($myhash1a as $key1a => $value1a)
{
if ($key1a == $key1)
{
$count1a = count($value1a);
$count_closed1=0;
for ($ia=0; $ia<$count1a; $ia++)
{
if ($value1a[$ia] == 4)
{
$count_closed1++;
}
}
}
}
foreach ($myhash1b as $key1b => $value1b)
{
if ($key1b == $key1)
{
$count1b = count($value1b);
$count_resolved1=0;
for ($ib=0; $ib<$count1b; $ib++)
{
if ($value1b[$ib] == 3)
{
$count_resolved1++;
}
}
}
}
foreach ($myhash01a as $key01 => $value01)
{
if ($key01 == $key1)
{
$count01 = count($value01);
$count_value01=0;
for ($ic=0; $ic<$count01; $ic++)
{
$count_value01=$count_value01 + $value01[$ic];
}
}
}
echo"
<tr>
<td><div align=\"center\">$key1</div></td>
<td><div align=\"center\">$count_open1</div></td>
<td><div align=\"center\">$count_resolved1</div></td>
<td><div align=\"center\">$count_closed1</div></td>
<td><div align=\"center\">$count_value01</div></td>
</tr>";
} ?>
Here is example of what i am getting
Name Total open Total Resolved Total Closed Alarm Count
cortrki 0 0 24 7376
hykesja 0 0 8 2481
shallch 0 5 8 2481
The Total Closed should be 0 not 8 on shallch and alarm count should be 0 not 2481 also on shallch