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 @@