diff --git a/panel_admin/includes/film_dao.php b/panel_admin/includes/film_dao.php index e0bb97c..badde38 100644 --- a/panel_admin/includes/film_dao.php +++ b/panel_admin/includes/film_dao.php @@ -1,5 +1,5 @@ mysqli, $exist) ; + if($film.is_null() ||$film["language"]!=$language){ + $sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`) + VALUES ( '%d', '%s', '%d', '%s','%s')", + $id, $tittle, $duration, $language,$description); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - + }else{ + die ('Error into query database film already exist'); + } return $sql; } @@ -39,10 +43,8 @@ while($fila=mysqli_fetch_array($resul)){ $films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]); } - $resul->free(); - - return $resul; + return $films; } //Returns a query to get all films tittles. @@ -89,8 +91,8 @@ } //Create a new film Data Transfer Object. - public function loadFilm($id, $tittle, $duration, $language){ - return new FilmDTO( $id, $tittle, $duration, $language); + public function loadFilm($id, $tittle, $duration, $language,$description){ + return new Film_DTO( $id, $tittle, $duration, $language,$description); } }