I need to create a table in my web pages that show the statistics of sales, for clarification, I have a table in SQL server that shows the daily sales I want to show in my web page a column present the days without duplication and next to every date the sum of sales for that days and then the sales for every branch in that day, I just can not match every single date with its statistic
<?php
$r = "SELECT distinct invoice_date from total_sales";
$result = sqlsrv_query($conn,$r);
$rresult = sqlsrv_query($conn,'SELECT distinct invoice_date from total_sales');
if( $result === false) {
die( print_r( sqlsrv_errors(), true) );
}
while($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)){
$dataaaa = $row;
foreach ($dataaaa as $value) {
print_r($value . "<br/>");
}
// foreach ($dataaaa as $row => $value) {
// print_r($value . "<br />");
// }
}
$mm = $value;
$num = 1;
$r = "SELECT * from total_sales where invoice_date = $mm";
$params2 = array();
$options2 = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt2 = sqlsrv_query( $conn, $r , $params2, $options2 );
$lateCount2 = sqlsrv_num_rows( $stmt2 );
if ($lateCount2 === false)
echo "Error in retrieveing row count.";
else
echo $lateCount2;
?>
<?php
while($user = sqlsrv_fetch_array($rresult)){
echo '
<tr>
<td scope="row">'.$num++.'</td>
<td>'.$user['invoice_date'].'</td>
<td>'.$mm.'</td>
<td><a href="?user_edit='.$user['invoice_date'].'" class="editBtn" name="log" onclick="goBack()">'.$lateCount2.'</a></td>
</tr>
';
}
?>