Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Conexion {
- private $servername ;
- private $username ;
- private $password ;
- private $database ;
- private $table ;
- private $port ;
- private $link;
- function getServername() {
- return $this->servername;
- }
- function getUsername() {
- return $this->username;
- }
- function getPassword() {
- return $this->password;
- }
- function getDatabase() {
- return $this->database;
- }
- function getTable() {
- return $this->table;
- }
- function getPort() {
- return $this->port;
- }
- function setServername($servername) {
- $this->servername = $servername;
- }
- function setUsername($username) {
- $this->username = $username;
- }
- function setPassword($password) {
- $this->password = $password;
- }
- function setDatabase($database) {
- $this->database = $database;
- }
- function setTable($table) {
- $this->table = $table;
- }
- function setPort($port) {
- $this->port = $port;
- }
- function getLink() {
- return $this->link;
- }
- function setLink($link) {
- $this->link = $link;
- }
- function Conexion() {
- echo ' <strong>Success!</strong> ';
- }
- function Conectar($host, $user, $password, $port, $Database, $table){
- $this->setServername($host);
- $this->setDatabase($Database);
- $this->setPort($port);
- $this->setUsername($user);
- $this->setPassword($password);
- $this->setTable($table);
- $this->setLink(mysqli_connect($this->getServername(), $this->getUsername(), $this->getPassword(), $this->getDatabase(), $this->getPort()));
- return mysqli_connect_errno();
- }
- function addConsultorio ( $nombre, $peso, $estatura, $Imc, $gradoObesidad ){
- $query = "INSERT INTO persona VALUES (null,'$nombre','$peso','$estatura','$Imc','$gradoObesidad')";
- mysqli_query($this->getLink(), $query);
- }
- // }
- // function calcularImc($Imc,$peso, $estatura){
- // $Imc=($peso)/($estatura*$estatura);
- //return $Imc;
- // }
- function gradoObesidad($Imc){
- if($Imc<18.5){
- $gradoObesidad="Usted tiene Desnutrición";
- }else
- if($Imc>=18.5 && $im<=24.9){
- $gradoObesidad= "Su peso es Normal";
- }else
- if($Imc>=25 && $im<=29.9){
- $gradoObesidad= "Usted tiene Sobrepeso";
- }else
- if($Imc>=30 && $im<=34.9){
- $gradoObesidad= "Tiene un problema de Obesidad";
- }else
- if($Imc>=35 && $im<=39.9){
- $gradoObesidad= "Tiene un problema de Obesidad Severa";
- }else
- if($Imc>=40){
- $gradoObesidad= "obeso severo";
- }
- return $gradoObesidad;
- }
- function borrarConsultorio($id){
- $query = "DELETE FROM persona WHERE ID =".$id;
- mysqli_query($this->getLink(), $query);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement