You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
2.3 KiB

<?php
/**
* List all vehiculos with a link to edit
*/
require "../../config.php";
require "../../common.php";
try {
$connection = new PDO($dsn, $username, $password, $options);
$sql = "SELECT * FROM carburante ORDER BY fecha DESC";
$statement = $connection->prepare($sql);
$statement->execute();
$result = $statement->fetchAll();
} catch(PDOException $error) {
echo $sql . "<br>" . $error->getMessage();
}
?>
<?php require "../templates/header.php"; ?>
<section id="five" class="main style1">
<div class="container">
<section>
<a href="menu.php" class="button small">Volver</a>
<br>
<h2>Actualizar repostajes</h2>
<table>
<thead>
<tr>
<th>#</th>
<th>Fecha</th>
<th>Vehículo</th>
<th>Kilómetros</th>
<th>Litros</th>
<th>Descuento</th>
<th>Precio/litro</th>
<th>Importe</th>
<th>Editar</th>
</tr>
</thead>
<tbody>
<?php foreach ($result as $row) : ?>
<tr>
<td><?php echo escape($row["identificador"]); ?></td>
<td><?php echo escape($row["fecha"]); ?></td>
<td><?php echo escape($row["vehiculo"]); ?></td>
<td><?php echo escape($row["kms"]); ?></td>
<td><?php echo escape(str_replace('.', ',',$row["litros"])); ?></td>
<td><?php echo escape(str_replace('.', ',',$row["descuento"])); ?></td>
<td><?php echo escape(str_replace('.', ',',$row["precioxlitro"])); ?></td>
<td><?php echo escape(str_replace('.', ',',$row["importe"])); ?></td>
<td><a
href="update-single.php?identificador=<?php echo escape($row["identificador"]); ?>">Edit</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</section>
<a href="menu.php" class="button small">Volver</a>
</div>
</section>
<?php require "../templates/footer.php"; ?>