diff --git a/Repostajes/common.php b/Repostajes/common.php new file mode 100755 index 00000000..10cecb19 --- /dev/null +++ b/Repostajes/common.php @@ -0,0 +1,39 @@ + PDO::ERRMODE_EXCEPTION + ); \ No newline at end of file diff --git a/Repostajes/data/.DS_Store b/Repostajes/data/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/Repostajes/data/.DS_Store differ diff --git a/Repostajes/data/automoviles.sql b/Repostajes/data/automoviles.sql new file mode 100755 index 00000000..d38755e4 --- /dev/null +++ b/Repostajes/data/automoviles.sql @@ -0,0 +1,36 @@ +CREATE DATABASE automoviles; + +USE automoviles; + +DROP TABLE IF EXISTS carburante; + +CREATE TABLE carburante ( + fecha date DEFAULT NULL, + vehiculo int(11) DEFAULT NULL, + kms int(11) DEFAULT NULL, + litros decimal(10,3) DEFAULT NULL, + descuento decimal(10,2) DEFAULT NULL, + precioxlitro decimal(10,3) DEFAULT NULL, + importe decimal(10,2) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_spanish_ci; + + +DROP TABLE IF EXISTS vehiculos; + +CREATE TABLE vehiculos ( + identificador int(11) NOT NULL, + marca text NOT NULL, + modelo text NOT NULL, + matricula text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + + +ALTER TABLE vehiculos + ADD PRIMARY KEY (identificador); + + +ALTER TABLE vehiculos + MODIFY identificador int(11) NOT NULL AUTO_INCREMENT; +COMMIT; + + diff --git a/Repostajes/data/init.sql b/Repostajes/data/init.sql new file mode 100644 index 00000000..2e604fc5 --- /dev/null +++ b/Repostajes/data/init.sql @@ -0,0 +1,13 @@ +CREATE DATABASE test; + +use test; + +CREATE TABLE users ( + id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY, + firstname VARCHAR(30) NOT NULL, + lastname VARCHAR(30) NOT NULL, + email VARCHAR(50) NOT NULL, + age INT(3), + location VARCHAR(50), + date TIMESTAMP +); \ No newline at end of file diff --git a/Repostajes/images/icons8-car-100.png b/Repostajes/images/icons8-car-100.png new file mode 100755 index 00000000..4aee6dad Binary files /dev/null and b/Repostajes/images/icons8-car-100.png differ diff --git a/Repostajes/images/icons8-gas-pump-100.png b/Repostajes/images/icons8-gas-pump-100.png new file mode 100755 index 00000000..26b8f04b Binary files /dev/null and b/Repostajes/images/icons8-gas-pump-100.png differ diff --git a/Repostajes/images/logo-coche.jpg b/Repostajes/images/logo-coche.jpg new file mode 100755 index 00000000..887a6964 Binary files /dev/null and b/Repostajes/images/logo-coche.jpg differ diff --git a/Repostajes/images/logo-gas-station.png b/Repostajes/images/logo-gas-station.png new file mode 100755 index 00000000..7157570b Binary files /dev/null and b/Repostajes/images/logo-gas-station.png differ diff --git a/Repostajes/index-old.php b/Repostajes/index-old.php new file mode 100755 index 00000000..1261c9f6 --- /dev/null +++ b/Repostajes/index-old.php @@ -0,0 +1,16 @@ + + +
+
+ +
+
+ +
+ + + + \ No newline at end of file diff --git a/Repostajes/index.php b/Repostajes/index.php new file mode 100755 index 00000000..85c34399 --- /dev/null +++ b/Repostajes/index.php @@ -0,0 +1,96 @@ +prepare($sql); + $statement->execute(); + + $result = $statement->fetchAll(); +?> +
+
+
+

Últimos repostajes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#FechaVehículoKilómetrosLitrosDescuentoPrecio/litroImporte
+ +
+
+
+ + + + + + + + + + + +
+
+
+

Base de datos inexistente

+
+
+

La base de datos no existe. ¿quieres inicializarla?

+ +
+
+
+ \ No newline at end of file diff --git a/Repostajes/install.php b/Repostajes/install.php new file mode 100755 index 00000000..cf6c8cf4 --- /dev/null +++ b/Repostajes/install.php @@ -0,0 +1,38 @@ +exec($sql); + + require "./gestionrepostajes/templates/header.php"; ?> + +
+
+
+

Base de datos creada

+
+
+

La base de datos ha sido creada con éxito

+ +
+
+
+ + +" . $error->getMessage(); +} \ No newline at end of file diff --git a/Repostajes/log/log_2023-Aug-08.log b/Repostajes/log/log_2023-Aug-08.log new file mode 100644 index 00000000..cd005559 --- /dev/null +++ b/Repostajes/log/log_2023-Aug-08.log @@ -0,0 +1,9 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 63.88. Total introducido: 63,88 +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 63.88. Total introducido: 63,88 +BORRA REPOSTAJE-> ID: 194 +BORRA REPOSTAJE-> ID: 195 +BORRA REPOSTAJE-> ID: 196 +BORRA REPOSTAJE-> ID: 197 +BORRA REPOSTAJE-> ID: 198 +BORRA REPOSTAJE-> ID: 199 +BORRA REPOSTAJE-> ID: 200 diff --git a/Repostajes/log/log_2023-Aug-10.log b/Repostajes/log/log_2023-Aug-10.log new file mode 100644 index 00000000..7dcc9544 --- /dev/null +++ b/Repostajes/log/log_2023-Aug-10.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.3899. Total con descuento: 44.9401. Total introducido: 46,33 diff --git a/Repostajes/log/log_2023-Aug-25.log b/Repostajes/log/log_2023-Aug-25.log new file mode 100644 index 00000000..10cf2faf --- /dev/null +++ b/Repostajes/log/log_2023-Aug-25.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.2186. Total con descuento: 39.4014. Total introducido: 40,62 diff --git a/Repostajes/log/log_2023-Aug-27.log b/Repostajes/log/log_2023-Aug-27.log new file mode 100644 index 00000000..937f06c6 --- /dev/null +++ b/Repostajes/log/log_2023-Aug-27.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 77.06. Total introducido: 77,06 diff --git a/Repostajes/log/log_2023-Dec-05.log b/Repostajes/log/log_2023-Dec-05.log new file mode 100644 index 00000000..b8b06cf0 --- /dev/null +++ b/Repostajes/log/log_2023-Dec-05.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 57.62. Total introducido: 57,62. Kilometros anteriores: 87503. Kilometros recorridos: 753 diff --git a/Repostajes/log/log_2023-Dec-17.log b/Repostajes/log/log_2023-Dec-17.log new file mode 100644 index 00000000..7a02b85e --- /dev/null +++ b/Repostajes/log/log_2023-Dec-17.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.6632. Total con descuento: 53.7768. Total introducido: 55,44. Kilometros anteriores: 88256. Kilometros recorridos: 708 diff --git a/Repostajes/log/log_2023-Nov-04.log b/Repostajes/log/log_2023-Nov-04.log new file mode 100644 index 00000000..1e6e7908 --- /dev/null +++ b/Repostajes/log/log_2023-Nov-04.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.1685. Total con descuento: 37.7815. Total introducido: 38,95. Kilometros anteriores: 12006. Kilometros recorridos: 421 diff --git a/Repostajes/log/log_2023-Nov-12.log b/Repostajes/log/log_2023-Nov-12.log new file mode 100644 index 00000000..c5ef3cbc --- /dev/null +++ b/Repostajes/log/log_2023-Nov-12.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.7112. Total con descuento: 55.3288. Total introducido: 57,04. Kilometros anteriores: 86021. Kilometros recorridos: 736 diff --git a/Repostajes/log/log_2023-Nov-21.log b/Repostajes/log/log_2023-Nov-21.log new file mode 100644 index 00000000..a9672936 --- /dev/null +++ b/Repostajes/log/log_2023-Nov-21.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 40. Total introducido: 40. Kilometros anteriores: 12427. Kilometros recorridos: 506 diff --git a/Repostajes/log/log_2023-Nov-24.log b/Repostajes/log/log_2023-Nov-24.log new file mode 100644 index 00000000..1117cf5c --- /dev/null +++ b/Repostajes/log/log_2023-Nov-24.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.746. Total con descuento: 56.454. Total introducido: 58,2. Kilometros anteriores: 86757. Kilometros recorridos: 746 diff --git a/Repostajes/log/log_2023-Oct-10.log b/Repostajes/log/log_2023-Oct-10.log new file mode 100644 index 00000000..e463d5ad --- /dev/null +++ b/Repostajes/log/log_2023-Oct-10.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 72.43. Total introducido: 72,43 diff --git a/Repostajes/log/log_2023-Oct-11.log b/Repostajes/log/log_2023-Oct-11.log new file mode 100644 index 00000000..d1bd3942 --- /dev/null +++ b/Repostajes/log/log_2023-Oct-11.log @@ -0,0 +1,8 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 89. Total introducido: 89. Kilometros anteriores: Array +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 78. Total introducido: 78. Kilometros anteriores: 90000 +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 78. Total introducido: 78. Kilometros anteriores: 91000. Kilometros recorridos: 1000 +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 66. Total introducido: 66. Kilometros anteriores: 11508. Kilometros recorridos: 8492 +BORRA REPOSTAJE-> ID: 210 +BORRA REPOSTAJE-> ID: 209 +BORRA REPOSTAJE-> ID: 211 +BORRA REPOSTAJE-> ID: 208 diff --git a/Repostajes/log/log_2023-Oct-15.log b/Repostajes/log/log_2023-Oct-15.log new file mode 100644 index 00000000..f0383228 --- /dev/null +++ b/Repostajes/log/log_2023-Oct-15.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.2486. Total con descuento: 40.3714. Total introducido: 41,62. Kilometros anteriores: 11508. Kilometros recorridos: 498 diff --git a/Repostajes/log/log_2023-Oct-28.log b/Repostajes/log/log_2023-Oct-28.log new file mode 100644 index 00000000..daddd025 --- /dev/null +++ b/Repostajes/log/log_2023-Oct-28.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 70.11. Total introducido: 70,11. Kilometros anteriores: 85104. Kilometros recorridos: 917 diff --git a/Repostajes/log/log_2023-Sep-14.log b/Repostajes/log/log_2023-Sep-14.log new file mode 100644 index 00000000..bf780dac --- /dev/null +++ b/Repostajes/log/log_2023-Sep-14.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.1442. Total con descuento: 36.9958. Total introducido: 38,14 diff --git a/Repostajes/log/log_2023-Sep-19.log b/Repostajes/log/log_2023-Sep-19.log new file mode 100644 index 00000000..fc2e0675 --- /dev/null +++ b/Repostajes/log/log_2023-Sep-19.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 77.26. Total introducido: 77,26 diff --git a/Repostajes/log/log_2023-Sep-27.log b/Repostajes/log/log_2023-Sep-27.log new file mode 100644 index 00000000..cc5c4a1f --- /dev/null +++ b/Repostajes/log/log_2023-Sep-27.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 35.85. Total introducido: 35,85 diff --git a/Repostajes/log/log_2024-Jan-06.log b/Repostajes/log/log_2024-Jan-06.log new file mode 100644 index 00000000..000d6284 --- /dev/null +++ b/Repostajes/log/log_2024-Jan-06.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.341. Total con descuento: 43.359. Total introducido: 44,7. Kilometros anteriores: 12933. Kilometros recorridos: 481 diff --git a/Repostajes/log/log_2024-Jan-07.log b/Repostajes/log/log_2024-Jan-07.log new file mode 100644 index 00000000..31eb076f --- /dev/null +++ b/Repostajes/log/log_2024-Jan-07.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 1.6098. Total con descuento: 52.0502. Total introducido: 53,66. Kilometros anteriores: 88964. Kilometros recorridos: 838 diff --git a/Repostajes/log/log_2024-Jan-08.log b/Repostajes/log/log_2024-Jan-08.log new file mode 100644 index 00000000..f948e21c --- /dev/null +++ b/Repostajes/log/log_2024-Jan-08.log @@ -0,0 +1,2 @@ +BORRA REPOSTAJE-> ID: 221 +CREA REPOSTAJE-> Descuento: 1.9098. Total con descuento: 61.7502. Total introducido: 63,66. Kilometros anteriores: 88964. Kilometros recorridos: 838 diff --git a/Repostajes/log/log_2024-Jan-22.log b/Repostajes/log/log_2024-Jan-22.log new file mode 100644 index 00000000..662cfec3 --- /dev/null +++ b/Repostajes/log/log_2024-Jan-22.log @@ -0,0 +1 @@ +CREA REPOSTAJE-> Descuento: 0. Total con descuento: 37.09. Total introducido: 37,09. Kilometros anteriores: 13414. Kilometros recorridos: 489 diff --git a/Repostajes/repostajes/create.php b/Repostajes/repostajes/create.php new file mode 100755 index 00000000..155f2357 --- /dev/null +++ b/Repostajes/repostajes/create.php @@ -0,0 +1,165 @@ + + + + +
+
+
+

Introducción de repostajes

+
+
+

Por favor, rellena todos los campos.

+ +
+
+
+ + +prepare($sql); + $smt->execute([$_POST['vehiculo']]); + $filas = $smt->fetchAll(); + + foreach ($filas as $row) { + $kmsanteriores=$row["kms"]; + } + + $kmsrecorridos=$_POST['kms']-$kmsanteriores; + + // + // Hasta aquí lo de conocer los kms del último repostaje + + $nuevo_repostaje = array( + "fecha" => $_POST['fecha'], + "vehiculo" => $_POST['vehiculo'], + "kms" => $_POST['kms'], + "litros" => str_replace(',', '.',$_POST['litros']), + "descuento" => $dto, + "precioxlitro" => str_replace(',', '.',strval($ellitro)), + "importe" => $totalcondto, + ); + + $sql = sprintf( + "INSERT INTO %s (%s) values (%s)", + "carburante", + implode(", ", array_keys($nuevo_repostaje)), + ":" . implode(", :", array_keys($nuevo_repostaje)) + ); + + /* + * Logs + */ + + $log_msg='CREA REPOSTAJE-> Descuento: '.$dto.'. Total con descuento: '.$totalcondto.'. Total introducido: '.$_POST['importe'].'. Kilometros anteriores: '.$kmsanteriores.'. Kilometros recorridos: '.$kmsrecorridos; + + escribe_log($log_msg); + + $statement = $connection->prepare($sql); + $statement->execute($nuevo_repostaje); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } + } +} + + +?> + + + +
successfully added.
+ +
+
+
+

Añadir repostaje

+ +
+ + +

+

+

+ +

+ +

+

+

+

+ +

+

+

+ +

+
+

+
+
+
+
+ + diff --git a/Repostajes/repostajes/delete.php b/Repostajes/repostajes/delete.php new file mode 100755 index 00000000..4dff0dc6 --- /dev/null +++ b/Repostajes/repostajes/delete.php @@ -0,0 +1,98 @@ +prepare($sql); + $statement->bindValue(':identificador', $identificador); + $statement->execute(); + + $success = "Repostaje borrado con éxito"; + + $log_msg='BORRA REPOSTAJE-> ID: '.$identificador; + + escribe_log($log_msg); + + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} + +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 . "
" . $error->getMessage(); +} +?> + + +
+
+
+

Borrar repostajes

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#FechaVehículoKilómetrosLitrosDescuentoPrecio/litroImporteBorrar
+
+
+
+
+ + \ No newline at end of file diff --git a/Repostajes/repostajes/menu.php b/Repostajes/repostajes/menu.php new file mode 100755 index 00000000..a19019a5 --- /dev/null +++ b/Repostajes/repostajes/menu.php @@ -0,0 +1,23 @@ + + +
+
+
+

Menú repostajes

+ +
+ + +
+
+ Volver +
+
+
+ + \ No newline at end of file diff --git a/Repostajes/repostajes/read.php b/Repostajes/repostajes/read.php new file mode 100755 index 00000000..7af60aa1 --- /dev/null +++ b/Repostajes/repostajes/read.php @@ -0,0 +1,118 @@ +prepare('SELECT matricula FROM vehiculos'); +$smt->execute(); +$vehiculos = $smt->fetchAll(); + +if (isset($_POST['submit'])) { + if (!hash_equals($_SESSION['csrf'], $_POST['csrf'])) die(); + + try { + $connection = new PDO($dsn, $username, $password, $options); + + $sql = "SELECT * + FROM carburante + WHERE vehiculo = :vehiculo ORDER BY fecha ASC" ; + + $marca = $_POST['vehiculo']; + $statement = $connection->prepare($sql); + $statement->bindParam(':vehiculo', $marca, PDO::PARAM_STR); + $statement->execute(); + + $result = $statement->fetchAll(); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} +?> + +
+
+
+

Busca repostajes por vehículo

+ +
+
+ +
+ + +
+
+
+ +
+
+
+
+
+
+ +rowCount() > 0) { ?> +
+
+
+

Resultados para vehículo

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#FechaVehículoKilómetrosLitrosDescuentoPrecio/litroImporteRecorridos
+ +
+
+
+ +
No results found for .
+ + diff --git a/Repostajes/repostajes/update-single.php b/Repostajes/repostajes/update-single.php new file mode 100755 index 00000000..6d175437 --- /dev/null +++ b/Repostajes/repostajes/update-single.php @@ -0,0 +1,90 @@ + $_POST['identificador'], + "fecha" => $_POST['fecha'], + "kms" => $_POST['kms'], + "litros" => str_replace(',', '.',$_POST['litros']), + "descuento" => str_replace(',', '.',$_POST['descuento']), + "precioxlitro" => str_replace(',', '.',$_POST['precioxlitro']), + "importe" => str_replace(',', '.',$_POST['importe']) + ]; + + $sql = "UPDATE carburante + SET identificador = :identificador, + fecha = :fecha, + kms = :kms, + litros = :litros, + descuento = :descuento, + precioxlitro = :precioxlitro, + importe = :importe + WHERE identificador = :identificador"; + + $statement = $connection->prepare($sql); + $statement->execute($kms); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} + +if (isset($_GET['identificador'])) { + try { + $connection = new PDO($dsn, $username, $password, $options); + $identificador = $_GET['identificador']; + + $sql = "SELECT * FROM carburante WHERE identificador = :identificador"; + $statement = $connection->prepare($sql); + $statement->bindValue(':identificador', $identificador); + $statement->execute(); + + $kms = $statement->fetch(PDO::FETCH_ASSOC); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} else { + echo "¡Algo ha salido mal!"; + exit; +} +?> + + + + +
successfully updated.
+ + +
+
+
+

Edita un repostaje

+ +
+ + $value) : ?> + + > + + +
+ +
+ Volver +
+
+ \ No newline at end of file diff --git a/Repostajes/repostajes/update.php b/Repostajes/repostajes/update.php new file mode 100755 index 00000000..38eadfb0 --- /dev/null +++ b/Repostajes/repostajes/update.php @@ -0,0 +1,66 @@ +prepare($sql); + $statement->execute(); + + $result = $statement->fetchAll(); +} catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); +} +?> + +
+
+
+

Actualizar repostajes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#FechaVehículoKilómetrosLitrosDescuentoPrecio/litroImporteEditar
">Edit +
+
+
+ +
+ + \ No newline at end of file diff --git a/Repostajes/templates/footer.php b/Repostajes/templates/footer.php new file mode 100755 index 00000000..8869328b --- /dev/null +++ b/Repostajes/templates/footer.php @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/Repostajes/templates/header.php b/Repostajes/templates/header.php new file mode 100755 index 00000000..a81aa1a4 --- /dev/null +++ b/Repostajes/templates/header.php @@ -0,0 +1,60 @@ + + + + + + + + + App de Gestión de Vehículos + + + + + + +
+
+
+

Gestión de Vehículos

+
+ + + + + + +
+
+ + \ No newline at end of file diff --git a/Repostajes/vehiculos/create.php b/Repostajes/vehiculos/create.php new file mode 100755 index 00000000..5be07a37 --- /dev/null +++ b/Repostajes/vehiculos/create.php @@ -0,0 +1,63 @@ + $_POST['marca'], + "modelo" => $_POST['modelo'], + "matricula" => $_POST['matricula'] + ); + + $sql = sprintf( + "INSERT INTO %s (%s) values (%s)", + "vehiculos", + implode(", ", array_keys($nuevo_coche)), + ":" . implode(", :", array_keys($nuevo_coche)) + ); + + $statement = $connection->prepare($sql); + $statement->execute($nuevo_coche); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} +?> + + + +
successfully added.
+ +
+
+
+

Añadir vehículo

+ +
+ +

+

+

+

+

+

+
+

+
+
+
+
+ + \ No newline at end of file diff --git a/Repostajes/vehiculos/delete.php b/Repostajes/vehiculos/delete.php new file mode 100755 index 00000000..ad48aa35 --- /dev/null +++ b/Repostajes/vehiculos/delete.php @@ -0,0 +1,84 @@ +prepare($sql); + $statement->bindValue(':identificador', $identificador); + $statement->execute(); + + $success = "User successfully deleted"; + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} + +try { + $connection = new PDO($dsn, $username, $password, $options); + + $sql = "SELECT * FROM vehiculos"; + + $statement = $connection->prepare($sql); + $statement->execute(); + + $result = $statement->fetchAll(); +} catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); +} +?> + +
+
+
+

Borrar vehículos

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
#MarcaModeloMatrículaBorrar
+
+
+
+
+ + \ No newline at end of file diff --git a/Repostajes/vehiculos/menu.php b/Repostajes/vehiculos/menu.php new file mode 100755 index 00000000..f913ad95 --- /dev/null +++ b/Repostajes/vehiculos/menu.php @@ -0,0 +1,22 @@ + + +
+
+ + + + +
+
+ +
+ + \ No newline at end of file diff --git a/Repostajes/vehiculos/read.php b/Repostajes/vehiculos/read.php new file mode 100755 index 00000000..1ef54df7 --- /dev/null +++ b/Repostajes/vehiculos/read.php @@ -0,0 +1,88 @@ +prepare($sql); + $statement->bindParam(':marca', $marca, PDO::PARAM_STR); + $statement->execute(); + + $result = $statement->fetchAll(); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} +?> + + +rowCount() > 0) { ?> +
+
+
+

Resultados

+ + + + + + + + + + + + + + + + + + + + +
#MarcaModeloMatrícula
+
+
+
+ +
No results found for .
+ +
+
+
+

Busca vehículo por marca

+ +
+
+ + +

+

+ + +
+
+
+
+
+ \ No newline at end of file diff --git a/Repostajes/vehiculos/update-single.php b/Repostajes/vehiculos/update-single.php new file mode 100755 index 00000000..18d785a8 --- /dev/null +++ b/Repostajes/vehiculos/update-single.php @@ -0,0 +1,84 @@ + $_POST['identificador'], + "marca" => $_POST['marca'], + "modelo" => $_POST['modelo'], + "matricula" => $_POST['matricula'] + ]; + + $sql = "UPDATE vehiculos + SET identificador = :identificador, + marca = :marca, + modelo = :modelo, + matricula = :matricula + WHERE identificador = :identificador"; + + $statement = $connection->prepare($sql); + $statement->execute($vehiculo); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} + +if (isset($_GET['identificador'])) { + try { + $connection = new PDO($dsn, $username, $password, $options); + $identificador = $_GET['identificador']; + + $sql = "SELECT * FROM vehiculos WHERE identificador = :identificador"; + $statement = $connection->prepare($sql); + $statement->bindValue(':identificador', $identificador); + $statement->execute(); + + $vehiculo = $statement->fetch(PDO::FETCH_ASSOC); + } catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); + } +} else { + echo "¡Algo ha salido mal!"; + exit; +} +?> + + + + +
successfully updated.
+ +
+
+
+

Edita un vehículo

+ +
+ + $value) : ?> + + > + +
+ +
+ + Volver +
+
+
+ \ No newline at end of file diff --git a/Repostajes/vehiculos/update.php b/Repostajes/vehiculos/update.php new file mode 100755 index 00000000..6a8e26fe --- /dev/null +++ b/Repostajes/vehiculos/update.php @@ -0,0 +1,57 @@ +prepare($sql); + $statement->execute(); + + $result = $statement->fetchAll(); +} catch(PDOException $error) { + echo $sql . "
" . $error->getMessage(); +} +?> + +
+
+
+

Actualizar vehículos

+ + + + + + + + + + + + + + + + + + + + + + +
#MarcaModeloMatrículaEditar
">Edit +
+
+
+
+ + \ No newline at end of file