Skip to content

Instantly share code, notes, and snippets.

Created March 13, 2018 17:21
What would you like to do?
<?php include_once "encabezado.php" ?>
include_once "base_de_datos.php";
$sentencia = $base_de_datos->query("SELECT * FROM productos;");
$productos = $sentencia->fetchAll(PDO::FETCH_OBJ);
<div class="col-xs-12">
<a class="btn btn-success" href="./formulario.php">Nuevo <i class="fa fa-plus"></i></a>
<table class="table table-bordered">
<th>Precio de compra</th>
<th>Precio de venta</th>
<?php foreach($productos as $producto){ ?>
<td><?php echo $producto->id ?></td>
<td><?php echo $producto->codigo ?></td>
<td><?php echo $producto->descripcion ?></td>
<td><?php echo $producto->precioCompra ?></td>
<td><?php echo $producto->precioVenta ?></td>
<td><?php echo $producto->existencia ?></td>
<td><a class="btn btn-warning" href="<?php echo "editar.php?id=" . $producto->id?>"><i class="fa fa-edit"></i></a></td>
<td><a class="btn btn-danger" href="<?php echo "eliminar.php?id=" . $producto->id?>"><i class="fa fa-trash"></i></a></td>
<?php } ?>
<?php include_once "pie.php" ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment