0
I have a table where I take all orders made on the day, but show all in a table, so far so good, but the customer needs to be grouped by those who asked, I will give an example,
On my table I have
ID_PEDIDO | ID_USER_PEDIDO | PEDIDO
1 | 20 | 524
5 | 52 | 258
2 | 35 | 525
6 | 52 | 253
3 | 20 | 658
4 | 20 | 358
The result appears to me as query and shows me all requests in order of request SELECT * FROM orders ORDER BY ID_PEDIDO ASC
If I put a GROUP BY ID_USER_PEDIDO will group the orders according to the user and show mo only 1
I need to be shown all of them grouped in the same table row
<table id="datatable1" class="table display responsive ">
<thead>
<tr>
<th class="">ID</th>
<th class="">ID do usuario</th>
<th class="">Pedido</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT * FROM pedidos ORDER BY ID_PEDIDO ASC";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
?>
<tr>
<td><?php echo $row["ID_PEDIDO"];?></td>
<td><?php echo $row["ID_USER_PEDIDO"];?></td>
<td><?php echo $row["PEDIDO"];?></td>
</tr>
<?php
}
?>
</tbody>
</table>
Have some way to appear as per the image below?
Picture below?? see picture no picture
– user60252
Sorry, the image didn’t go, I just entered
– Marcos Paulo