Код: Выделить всё
$sql = "SELECT * FROM `user` WHERE `UserID` = " . $pupID;
$result = $conn->query($sql);
if ($result->num_rows == 1) {
$row = $result->fetch_assoc();
$this->name = $row['Name'];
$this->email = $row['Email'];
$this->hashedPassword = $row['Password'];
$this->role = $row['Role'];
} else {
header("Location: error.php?type=4");
die();
}
# Load handler data
$sql = "SELECT HandlerID FROM `puphandler` WHERE `PupID` = " . $pupID;
$result = $conn->query($sql);
if ($result->num_rows == 1) {
$row = $result->fetch_assoc();
$this->handlerID = $row['HandlerID'];
} else {
header("Location: error.php?type=5");
die();
}
Код: Выделить всё
PROCEDURE `getPup`(IN `pupID` INT) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER BEGIN SELECT * FROM `user` WHERE `UserID` = pupID; END
PROCEDURE `getPupHandler`(IN `pupID` INT) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER BEGIN SELECT HandlerID FROM `puphandler` WHERE `PupID` = pupID; END
Подробнее здесь: https://stackoverflow.com/questions/793 ... procedures