The code that you sent awhile ago works perfectly on my system so I also used it in another module in which the admin can view the also view the date. But I encountered problems.
This is the case, the first user who added his/her order first and even the next user who has same name and section is now being recorded and saved correctly. However, the problem is when the recording is done, it shows a duplicate value of the first order that is recorded.
DATE | NAME | SECTION | PAYABLE | PRODUCT | QUANTITY
10/04/18 | User1 | Section 1 | 990 | Magic Mug | 3
| T-shirt | 3
10/04/18 | User1 | Section 1 | 630 | Magic Mug | 3
| Thumbler | 2
10/04/18 | User1 | Section 1 | 990 | Magic Mug | 3
| T-shirt | 3
This is the PHP code I used in which I only added date to your code.
$last_date = NULL;
$last_name = NULL;
$last_section = NULL;
$last_payable = NULL;
while ($row = mysql_fetch_array($result)) {
$date = "";
$name = "";
$section = "";
$payable = "";
if ($last_name === NULL || $last_date != $row['date'] ||
$last_name != $row['name'] ||
$last_section != $row['section'] ||
$last_payable != $row['payable']) {
$last_date = $row['date'];
$last_name = $row['name'];
$last_section = $row['section'];
$last_payable = $row['payable'];
$date = $row['date'];
$name = $row['name'];
$section = $row['section'];
$payable = $row['payable'];
}
echo '<tr style="text-align:center;">';
echo '<td>'.$date.'</td>';
echo '<td>'.$name.'</td>';
echo '<td>'.$section.'</td>';
echo '<td>'.$payable.'</td>';
echo '<td>'.$row['product'].'</td>';
echo '<td>'.$row['qty'].'</td>';
echo '</tr>';
}