From 62fe03a7a1305bdd3e853693fd2f9fcd2bf84965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mu=C3=B1oz=20Garcia?= <73303506+danimu03@users.noreply.github.com> Date: Mon, 12 Apr 2021 12:26:12 +0200 Subject: [PATCH] Add files via upload --- panel_admin/includes/film_dao.php | 110 +++++++++++--------- panel_admin/includes/film_dto.php | 3 +- panel_admin/includes/film_dto_interface.php | 2 +- 3 files changed, 65 insertions(+), 50 deletions(-) diff --git a/panel_admin/includes/film_dao.php b/panel_admin/includes/film_dao.php index 1c69c87..d8f2933 100644 --- a/panel_admin/includes/film_dao.php +++ b/panel_admin/includes/film_dao.php @@ -1,47 +1,63 @@ -mysqli, $sql) or die ('Error into query database'); - - return $resul; - } - - //Returns a query to get All the films. - public function allFilmData(){ - $sql = sprintf( "SELECT * FROM film "); - $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - - return $resul; - } - - //Create a new film Data Transfer Object. - public function loadFilm($id, $tittle, $duration, $language){ - return new FilmDTO( $id, $tittle, $duration, $language); - } - - } - -?> +mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + + //Returns a query to get All the films. + public function allFilmData(){ + $sql = sprintf( "SELECT * FROM film "); + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + while($fila=mysqli_fetch_array($resul)){ + $films[] = $this->loadFilm($fila["id"], $fila["tittle"],$fila["duration"],$fila["language"],$fila["description"]); + } + return $films; + } + + //Create a new film Data Transfer Object. + public function loadFilm($id, $tittle, $duration, $language, $description){ + return new FilmDTO( $id, $tittle, $duration, $language, $description); + } + + /*public function addFilm($films) { + $resul = mysqli_query($this->mysqli, $this->createFilm($film.getId(), $film.getTittle(), $film.getDuration(), $film.getLanguage(), $film.getDescription())) or die ('Error into query database'); + return $resul; + }*/ + + //Returns a query to get all films tittles. + public function tittleFilmData(){ + $sql = sprintf( "SELECT tittle FROM film "); + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); + + return $resul; + } + + } + +?> \ No newline at end of file diff --git a/panel_admin/includes/film_dto.php b/panel_admin/includes/film_dto.php index a88ea42..55840bd 100644 --- a/panel_admin/includes/film_dto.php +++ b/panel_admin/includes/film_dto.php @@ -1,7 +1,6 @@