Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pages/Ingrediente/Detalle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
include '../../template/Header/Header.php';
echo '<h1>Ingredientes de ' . ($_GET["titulo"]. $_GET["id"]) . '</h1>';
//CONEXIÓN CON LA BASE DE DATOS
require './database/dbconnect.php';
$mysqli = conectar();
//CONSULTA A LA BASE DE DATOS
$resultado = $mysqli->query("SELECT * FROM ingrediente WHERE id=".$_GET["id"]);
$ingrediente = $resultado->fetch_assoc(); //En otros ejemplos habíamos usado $reg, como ahora consultamos ingrediente, cambia a $ingrediente
//MOSTRAMOS DATOS
echo '<ul>';
echo '<li>ID del ingrediente: '.$ingrediente['id'].'</li>';
echo '<li>Nombre del ingrediente: '.$ingrediente['nombre'].'</li>';
echo '<li>Cantidad/es: '.$ingrediente['cantidad'].'</li>';
echo '</ul>';

//BOTON REDIRECCIÓN A ÍNDICE
echo '<pre>'; print_r($_REQUEST); echo '</pre>'; //MUESTRA VARIABLES GET Y POST
echo $_REQUEST["Volver al índice"];

?>
22 changes: 22 additions & 0 deletions pages/Ingrediente/Ingrediente.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

//CONEXION CON BBDD
require '../../database/dbconnect.php';
$mysqli = conectar();
//CONSULTA BDD
$resultado = $mysqli->query("INSERT id, nombre, cantidad INTO ingrediente"); //FUNCION INSERT PARA AÑADIR A LA TABLA

//MOSTRAMOS RESULTADOS
echo '<ol>';
while($reg=$resultado->fetch_assoc()){
echo '<li>';
echo '<a href="<a href="http://localhost/dev/phpRestaurante/pages/ingrediente/ingrediente.php?id='.$reg['id'].'&titulo='.$reg['titulo'].'">'.$reg['titulo'].'</a>';
echo '</li>';
}
echo '</ol>';

//BOTON REDIRECCIÓN A ÍNDICE
echo '<pre>'; print_r($_REQUEST); echo '</pre>'; //MUESTRA VARIABLES GET Y POST
echo $_REQUEST["Volver al índice"];

?>
22 changes: 22 additions & 0 deletions pages/Ingrediente/action_ingrediente.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

//CONEXION CON BBDD
require '../../database/dbconnect.php';
$mysqli = conectar();
//CONSULTA BDD
$resultado = $mysqli->query("SELECT id, nombre, cantidad FROM ingrediente");

//MOSTRAMOS RESULTADOS
echo '<ol>';
while($reg=$resultado->fetch_assoc()){
echo '<li>';
echo '<a href="<a href="http://localhost/dev/phpRestaurante/pages/ingrediente/detalle.php?id='.$reg['id'].'&titulo='.$reg['titulo'].'">'.$reg['titulo'].'</a>';
echo '</li>';
}
echo '</ol>';

//BOTON REDIRECCIÓN A ÍNDICE
echo '<pre>'; print_r($_REQUEST); echo '</pre>'; //MUESTRA VARIABLES GET Y POST
echo $_REQUEST["Volver al índice"];

?>
25 changes: 25 additions & 0 deletions pages/Ingrediente/nuevoIngrediente.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vista Añadir ingrediente/s</title>
</head>

<body>

<!-- - Añadimos formulario action=action_ingrediente.php method= post para conectar a la función

- Después añadimos el formulario de inputs con los siguientes espacios: id,nombre del ingrediente y cantidad
-->
<form action="action_ingrediente.php" method="post">
<p>Introduce el nuevo id: <input type="number" number="" /></p>
<p>Introduce el nuevo nombre del ingrediente: <input type="text" name="" /></p>
<p>Introduce la nueva cantidad: <input type="number" number="" /></p>
<p><input type="submit" /></p>
</form>
</body>

</html>
4 changes: 2 additions & 2 deletions pages/Login/Login.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

include '../../template/Header/Header.php';
include './template/Header/header.php';
?>
<form action="action_login.php" method="post">
<div>Nombre: <input type="text" name="nombre"></div>
Expand All @@ -9,5 +9,5 @@
</form>
<?php

include '../../template/Footer/Footer.php';
include './template/Footer/footer.php';
?>
8 changes: 6 additions & 2 deletions template/Header/Header.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<!DOCTYPE html>

<?php

echo '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
Expand All @@ -7,5 +10,6 @@
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<body>'

?>