Pegar resultados de outra tabela para exibir os produtos
<!--------------------------------
PEDIDOS ------------------------->
<div class="table-responsive mt-2">
<table class="table table-bordered table-striped text-center">
<thead>
<tr>
<td colspan="8">
<h4 class="text-center text-info m-0">Pedidos realizados</h4>
</td>
</tr>
<tr>
<th>ID pedido</th>
<th>Nome cliente</th>
<th>E-mail</th>
<th>Endereço</th>
<th>Número da casa</th>
<th>Referência</th>
<th>ID cliente</th>
</tr>
</thead>
<tbody>
<?php
require 'conexao_pedidos.php';
$stmt = $conn->prepare("SELECT * FROM orders");
$stmt->execute();
$result = $stmt->get_result();
$grand_total = 0;
while($row = $result->fetch_assoc()):
?>
<tr>
<td>
<?= $row['order_id'] ?></td>
<td>
<?= $row['order_name'] ?></td>
</td>
<td><?= $row['order_email'] ?>
</td>
<td>
<?= $row['order_endereco'] ?>
</td>
<td>
<?= $row['order_numero'] ?>
</td>
<td><?= $row['order_referencia'] ?></td>
<td><?= $row['id_usuario'] ?> </td>
<td>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#exampleModal<?= $row['order_id'] ?>">
<i class="fa fa-info-circle"></i> Produtos
</button>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
<?php
require 'conexao_pedidos.php';
$stmt = $conn->prepare("SELECT * FROM orders");
$stmt->execute();
$result = $stmt->get_result();
$grand_total = 0;
while($row = $result->fetch_assoc()):
?>
<div class="modal fade" id="exampleModal<?= $row['order_id'] ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<?= $row['order_id'] ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<?php endwhile; ?>Discussão (3)
Carregando comentários...