Code: Select all
$patches = array();
// FETCH CURRENT YEAR PATCHES
while($row = mssql_fetch_array($result))
{
//echo "<td>" . $row["patch"] . "</td>";
$mspatch = $row["patch"];
$patches[] = $mspatch;
}Moderator: General Moderators
Code: Select all
$patches = array();
// FETCH CURRENT YEAR PATCHES
while($row = mssql_fetch_array($result))
{
//echo "<td>" . $row["patch"] . "</td>";
$mspatch = $row["patch"];
$patches[] = $mspatch;
}Code: Select all
$patches = array();
// FETCH CURRENT YEAR PATCHES
while($row = mssql_fetch_array($result))
{
//echo "<td>" . $row["patch"] . "</td>";
$patches[] = array($row['patch']);
}Code: Select all
$query2 = "SELECT patch, COUNT(server) AS count FROM PatchStatus WHERE site = '$site' AND status <> 'Patched' AND status <> 'Unsupported OS' and patch like '$patch' GROUP BY patch ORDER BY patch asc ";
$result2 = mssql_query($query2);
$numRows = mssql_num_rows($result2);
//$cols2 = array('MS06-001'=>array('1',),'MS06-007'=>array('8',),'MS06-008'=>array('50',));
$cols = array('patch_col'=>array('count_col'),);
while($row = mssql_fetch_array($result2))
{
//echo "<td>".$row["patch"]."</td><td>" . $row["count"] . "</td>";
$cols[$row["patch"]] = array($row["count"]);
}Code: Select all
$cols[$row["patch"]] = array($row["count"]);Code: Select all
foreach ($sitecodes as $site) {
//echo "<tr><td>$site";
$query2 = "SELECT site, patch, COUNT(server) AS count FROM PatchStatus WHERE site = '$site' AND status <> 'Patched' AND status <> 'Unsupported OS' and patch like '$patch' GROUP BY patch ORDER BY patch asc ";
$result2 = mssql_query($query2);
$numRows = mssql_num_rows($result2);
//$cols2 = array('MS06-001'=>array('1',),'MS06-007'=>array('8',),'MS06-008'=>array('50',));
//$cols = array('patch_col'=>array('count_col'),);
while($row = mssql_fetch_array($result2))
{
//echo "<td>".$row["patch"]."</td><td>" . $row["count"] . "</td>";
[b]$cols[$row["site"]] = array($row["patch"])=>array($row["count"]); [/b]
}
echo "</tr>";
var_export($cols);Code: Select all
// make sure the main index exists
if (!isset($cols[$row['site']]))
{
$cols[$row['site']] = array();
}
$cols[$row['site']][$row['patch']] = array($row['count']);Code: Select all
//////////// output table
//echo '<p>There are '.sizeof($cols)." Patches.</p>\n";
?>
/////////// list patches going sideways ---- this section works fine.
echo "<tr><th>Vulerable Patches</th></tr><tr><td>Site</td>";
foreach( $current_patchs as $patchs )
{
echo "<td>".$patchs."<td></tr>";
}
echo "<br><tr>";
/// list sites going across in site patch1(count), patch2(count) -- this section does not work
foreach ( $cols as $site)
{
echo"<tr><td>$site</td></tr>";
}
</tr>
</table>
</body>
</html>Code: Select all
/////////// list patches going sideways
echo "<tr><th>Vulerable Patches</th></tr><tr><td>Site</td>";
foreach( $current_patchs as $patchs )
{
echo "<td>".$patchs."</td></tr>";
}
echo "<br><tr>";
///////////// list site and patch count going sideways......
foreach ( $cols as $site=>$patch)
{
echo"<tr><td>$site</td>";
foreach ( $cols as $patch=>$count)
{
}
foreach ($cols as $patch=>$count)
{
echo "<td> ".$count." </td>";
}
echo "</tr>";
}
?>
</tr>
</table>
</body>
</html>