1
I am creating a Json file, but I need to remove the last comma from the pad referring to the last record.
This json will be used in Datatable
{
"data": [
<?php foreach ($rs as $row): ?>
[
"<?= $row['ID_Receita']; ?>",
"<?= $row['nome']; ?>",
"<?= $row['valor']; ?>",
"<?= $row['dataVenci']; ?>",
"<?= $row['formaEntrada']; ?>"
],
<?php endforeach; ?>
]
}
How can I do that?
@Angelosoares as would be the correct way to assemble this json?
– Tiago
The correct way is to mount an array in PHP and pass one
json_encode
in it. What you are doing can go wrong in several different ways...– bfavaretto