I have an issue where I'm doing a sqlsrv_fetch_array to fetch rows from a SQL server query.
I'm then doing some post processing to echo the rows that fall within the working day criteria using the workingdays function here
the variable $esc is a number E.G. "7 Days" hence we pull the number only. My resulting post processing syntax looks like this.
<?php
Include 'Connectioninfo.php';
Include 'wkgdaysfunction.php';
$sql = "SELECT some SQL";
$result = sqlsrv_query($conn,$sql);
echo "<table id=\"table\" class=\"tablesorter\"><thead><tr><th><center>Ticket#</center></th></tr></thead><tbody>";
while($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
// The Priortiy row creates an array showing as "X days" based on the priority and is taken from the DB
$esc = isset($esccom[$row["PRIORITY"]])?$esccom[$row["PRIORITY"]]:"";
$endDate = time(); //strtotime("now"),"\n";
//START_DATE is from the DB
$startDate = strtotime(date('m/d/y', $row["START_DATE"]) );
$workingDays = floor(getWorkingDays($startDate,$endDate,$holidays)) ;
if($workingDays >= (substr($esc,0,1) -1)){
echo "<tr id=".$rowColour."><td>" . $row["TICKET"] . "</td></tr>";
}
}
echo "</tbody></table>";
sqlsrv_close( $conn );
?>
As expected this returns the rows where the number of working days bewteen X&Y are greater than or equal to $esc.
What I'm struggling to work out now is how to count the number of rows and echo the number returned from the post processing.
Is there some form of countif I can use?