0
I have a mysql field called description, it stores arrays separated by '|'. forming a group.
When I have more than one group I add a * to the end to say that it is a new group.
2|Bags with gold finish |1|16,80|16.80 * 8|test bags 2 |3|9|27.00
I need to separate and show as follows:
2 Bags with gold finish 1 16,80 16,80 8 test Bags 3 9 27,00
If there are in the database 3.. 4..8 lines it must fill in these lines.
for example: 2 Bags with gold finish 1 16,80 16,80
<?php
foreach($oss_list as $cat_edit){
$descricao= $cat_edit['descricao'];
$campos = explode('|', $descricao);
$array = [];
//pega o total de linhas
$totaldelinhas = substr_count($descricao, '*');
$ir = 0;
while ($ir < $totaldelinhas) {
echo $tt = explode("|",$descricao);
?>
<tr>
<td><input type="text" class="form-control cod" id="cod" name="cod[]" value=""></td>
<td><input type="text" class="form-control desc" id="desc" name="desc[]"></td>
<td><input type="text" class="form-control" id="qnd" name="qnd[]"></td>
<td><input type="text" class="form-control" id="vlund" name="vlund[]" onblur="calcular()"></td>
<!-- todos os inputs com style="display: none; são para uso nos calculos-->
<td><input style="display: none;" type="text" class="form-control soma" id="vltotal" name="vltotal[]" onblur="calcular()">
<input type="text" class="form-control somaS" id="vltotalS"></td>
</tr>
<?php
$ir++;
}
}
?>
8 test Bags 3 9 27,00 4 test Bags 4 4 7 23,00
how do I do that?
He created 3 input lines ( was 2 because I have two result groups and filled only the first one
– Richard Barcelos
@Richardbarcelos got it right?
– Sr. André Baill
Hello Friend, I changed the script, before registering everything in the bank in the same column I created a table for the description only.. then gave a foreach before the <tr> populating the fields. was beautiful, thanks for the support.
– Richard Barcelos
Perfect, if you can accept my answer... if it helped you, thank you.
– Sr. André Baill