Created
August 8, 2019 01:10
-
-
Save parzibyte/07abc9489410b020d9e5592dc8455c4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (empty($_GET["id"])) { | |
exit("No hay ID"); | |
} | |
#Si llegamos hasta aquí es porque los datos al menos están definidos | |
include_once __DIR__ . "/base_de_datos.php"; #Al incluir este script, podemos usar $baseDeDatos | |
# creamos una variable que tendrá la sentencia | |
$sentencia = $baseDeDatos->prepare("DELETE FROM videojuegos WHERE id = :id"); | |
#Pasar los datos... | |
$sentencia->bindParam(":id", $_GET["id"]);#Aquí pasamos el ID | |
$resultado = $sentencia->execute(); | |
if($resultado === true){ | |
echo "Videojuego eliminado correctamente"; | |
echo '<br><a href="3_tabla_dinamica.php">Ver los videojuegos</a>'; | |
}else{ | |
echo "Lo siento, ocurrió un error"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment