0
I am developing an application, and I need to format the display on the screen for the user. because the data, value and status fields are being represented in the way that Mysql stores the values, and the year is appearing in the YYYY/MM/DD standard, the amount I want to appear in R$ and the status field that is represented by 1 I want to appear APPROVED and the number 2 DISAPPROVED. I’ve done the SELECTS part inside the HTML using PHP with PDO access.
<div class="container">
<table class="table table-dark">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Nome</th>
<th scope="col">Título</th>
<th scope="col">Categoria</th>
<th scope="col">Data</th>
<th scope="col">Valor</th>
<th scope="col">Descrição</th>
<th scope="col">Status</th>
</tr>
</thead>
<?php
$sql = "SELECT * FROM campos WHERE status_ped = 1 OR status_ped = 2";
$busca = $conexao->query($sql);
while ($array = $busca->fetch(PDO::FETCH_ASSOC)) {
$id = $array['id'];
$nome = $array['nome'];
$titulo = $array['titulo'];
$tipo = $array['tipo'];
$data_despesa = $array['data_despesa'];
$valor = $array['valor'];
$descricao = $array['descricao'];
$staus_ped = $array['status_ped'];?>
<tr>
<td><?php echo $id?></td>
<td><?php echo $nome?></td>
<td><?php echo $titulo?></td>
<td><?php echo $tipo?></td>
<td><?php echo $data_despesa?></td>
<td><?php echo $valor?></td>
<td><?php echo $descricao?></td>
<td><?php echo $staus_ped?></td>
</tr>
<?php } ?>
</table>
</div>
<td><? php echo date("d-m-Y", strtotime($data_expense));? ></td> if you want to trade - for /
– user60252
<td><? php echo ('R$ '. $value.',00')? ></td>
– user60252
<td><? php echo ($staus_ped == 1 ? "OK" "FAILED");? ></td>
– user60252
https://ideone.com/O0CZcx
– user60252