Editar/Eliminar sesiones

This commit is contained in:
OscarRui 2021-05-06 10:32:11 +02:00 committed by GitHub
parent 62fec4883d
commit db298d1ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 2 deletions

View File

@ -55,6 +55,34 @@
} else return "Error al conectarse a la base de datos"; } else return "Error al conectarse a la base de datos";
} }
public static function edit_session($session){
$bd = new SessionDAO('complucine');
if($bd ){
if($bd->searchSession($session['cinema'], $session['origin_hall'],$session['origin_start'],$session['origin_date'])){
$origin = array("cinema" => $session['cinema'],"hall" => $session['origin_hall'],"start" => $session['origin_start'],"date" => $session['origin_date']);
$bd->editSession($session['film'], $session['hall'], $session['cinema'], $session['date'],
$session['start'], $session['price'], $session['format'],$origin);
return "Se ha editado la session con exito";
} else
return "Esta session no existe";
} else return "Error al conectarse a la base de datos";
}
public static function delete_session($session){
$bd = new SessionDAO('complucine');
if($bd ){
if($bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){
$bd->deleteSession($session['hall'], $session['cinema'], $session['date'], $session['start']);
return "Se ha eliminado la session con exito";
} else
return "Esta session no existe";
} else return "Error al conectarse a la base de datos";
}
//Esto deberia estar en film.php? seguramente //Esto deberia estar en film.php? seguramente
public static function getFilmTitle($idfilm){ public static function getFilmTitle($idfilm){
$bd = new Film_DAO('complucine'); $bd = new Film_DAO('complucine');

View File

@ -67,7 +67,7 @@
return $sessions; return $sessions;
} }
public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){ public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){
$format = $this->mysqli->real_escape_string($format); $format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) ); $date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) ); $startTime = date('H:i:s', strtotime( $startTime ) );
@ -77,7 +77,7 @@
`start_time` = '%s', `seat_price` = '%d', `format` = '%s' `start_time` = '%s', `seat_price` = '%d', `format` = '%s'
WHERE WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]); $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin["cinema"],$origin["hall"],$origin["date"],$origin["start"]);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');