-
-
Save parzibyte/02a7c1a9dc0291766e182eaf2607f5d9 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 | |
$id = 1; | |
include_once "base_de_datos.php"; | |
$sentencia = $base_de_datos->prepare("SELECT id, nombre, edad FROM mascotas WHERE id = ?;"); | |
$sentencia->execute([$id]); | |
$mascota = $sentencia->fetchObject(); | |
if (!$mascota) { | |
#No existe | |
echo "¡No existe alguna mascota con ese ID!"; | |
exit(); | |
} | |
#Si la mascota existe, se ejecuta esta parte del código | |
# Aquí hacer algo con $mascota... | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment