-
-
Save parzibyte/ee225c8fe0c104eae0c2d3503239f0ad 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 | |
include_once "base_de_datos.php"; | |
$id = 1; // El id con el que se hace el where | |
$nombre = "ASD"; // El nuevo nombre | |
$edad = 2; // La nueva edad | |
$sentencia = $base_de_datos->prepare("UPDATE mascotas SET nombre = ?, edad = ? WHERE id = ?;"); | |
$resultado = $sentencia->execute([$nombre, $edad, $id]); # Pasar en el mismo orden de los ? | |
if ($resultado === true) { | |
# OK | |
} else { | |
echo "Algo salió mal. Por favor verifica que la tabla exista, así como el ID del usuario"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment