0
I need to join in a table row when the addresses repeat bringing only one address of the three I have, follow code below:
<table class="tableModif">
<thead>
<tr>
<th>Romaneio</th>
<th>Placa</th>
<th>Cte</th>
<th>Data Saida</th>
<th>Endereço</th>
</tr>
</thead>
<tbody>
<?php foreach ($roteiro->ListaRoteiro($romaneioIni, $romaneioFin, $dataIni, $dataFin, $empIni, $empFin) as $dados) { ?>
<tr>
<td><?php echo $dados->getRomaneio(); ?></td>
<td><?php echo $dados->getPlaca(); ?></td>
<td><?php echo $dados->getCte(); ?></td>
<td><?php echo ($roteiro->FormataData($dados->getDtSaidaRomaneio())); ?></td>
<td><?php echo $dados->getEndereco(); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
How are you:
I guess this is coming from the bank right? wouldn’t it be better if you use groupby in the query?
– JuniorNunes
Yes, serious but would like to treat in php same.
– KevinF
The ideal was to do a better query but if you want to do it in php, you will have to filter the result. If the boards are the only repeating field, do one foreach inside another, taking only the board in the inner loop and adding in the array as scoreboard 1, scoreboard 2, scoreboard 3 and so on.
– Cleiton Oliveira