1
I have the following situation.
A table that displays the searched results in mysql, and within this table I have a column where the edit button is. How do I get this button to edit the content shown on that line?
I’m wearing the bow tie while
to display them and, as far as I know, the ribbon while
does not count what was displayed/found first or second. Right?
For example;
in the code below I used mysql to search in the table "request" everything that has the word "waiting..." in the status column.
The noose while
will display one by one in order you find, and display more or less like this:
ID | Produto | Valor | Cód. Pedido | Situação | Editar
1 | Produto 1 | 1.00 | 321 | Aguardando... | Botão Editar
And so it goes, ID 2, Product 2 and so on.
How could I make the button at the end of the table edit inside mysql the row it is on?
<section class="news">
<div class="page-reader">
<h3>Lista de Pedidos <small>atualizado em <?= date("d/m/Y") ?></small></h3>
</div>
<table class="table table-striped">
<tr>
<td>ID</td>
<td>Produto</td>
<td>Valor</td>
<td>Código do Pedido</td>
<td>Situação</td>
<td>Editar Pedido</td>
<!-- Coloca os dados em um Array -->
<?php
while ($resultado = mysqli_fetch_assoc($dados)) { ?>
</tr>
<td><?= $resultado['id']; ?></td>
<td><?= $resultado['produto']; ?></td>
<td><?= "R$ ". number_format($resultado['valor'],2); ?></td>
<td><?= $resultado['pedido']; ?></td>
<td><?= $resultado['status']; ?></td>
<td><button type="button" class="btn btn-primary">Confirmar</button> <button class="btn btn-danger">Cancelar</button></td>
<?php
}
?>
</table>
</section>
Edit which field?
– Papa Charlie
Edit the Status field. the commands for editing I know and can do, but I only know if I get the variable sent via post or get.
– RFL
Then you have a list of N records and all with one button to change the status only, correct, with click and update without Reload on the page. You can do this with jQuery.
– Papa Charlie
See if that reply help you.
– Papa Charlie
Papa Charlie, I tried to follow the topic you gave me but I couldn’t and I don’t think it’s what I need. I think you misunderstood my request.
– RFL
I don’t know what might have generated that "offensive" warning, it might be some system bug. If it happens again, please take a screenshot and signal the post indicating the image link, so a moderator can evaluate. I left the question as Victor had left it, because I considered it the best state of it. As for the answer, please be patient. The people who help here are all volunteers, but sooner or later you get an answer. Thank you.
– bfavaretto