Creando film_dao basado en los dao ya existentes

This commit is contained in:
marian1010 2021-04-10 01:13:59 +02:00 committed by GitHub
parent 7bb31aac8e
commit 35e1cc7405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

39
panel_admin/film_dao.php Normal file
View File

@ -0,0 +1,39 @@
<?php
require_once('../assets/php/dao.php');
include_once('film_dto.php');
class Film_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Session.
public function createFilm($id, $tittle, $duration, $language){
$sql = sprintf( "INSERT INTO film( $id, $tittle, $duration, $language)
VALUES ( '%d', '%s', '%d', '%s')",
$id, $tittle, $duration, $language);
return $sql;
}
//Returns a query to get the film's data.
public function FilmData($id){
$sql = sprintf( "SELECT * FROM film WHERE id = '%d'", $id );
$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);
}
}
?>