Add files via upload
This commit is contained in:
parent
1e91584f47
commit
62fe03a7a1
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('../assets/php/dao.php');
|
include_once('../assets/php/dao.php');
|
||||||
include_once('film_dto.php');
|
include_once('film_dto.php');
|
||||||
|
|
||||||
class Film_DAO extends DAO {
|
class FilmDAO extends DAO {
|
||||||
|
|
||||||
//Constructor:
|
//Constructor:
|
||||||
function __construct($bd_name){
|
function __construct($bd_name){
|
||||||
@ -12,11 +12,12 @@
|
|||||||
//Methods:
|
//Methods:
|
||||||
|
|
||||||
//Create a new Session.
|
//Create a new Session.
|
||||||
public function createFilm($id, $tittle, $duration, $language){
|
public function createFilm($id, $tittle, $duration, $language, $description){
|
||||||
|
|
||||||
|
$sql = sprintf( "INSERT INTO film( $id, $tittle, $duration, $language, $description)
|
||||||
|
VALUES ( '%d', '%s', '%d', '%s', '%d')",
|
||||||
|
$id, $tittle, $duration, $language, $description);
|
||||||
|
|
||||||
$sql = sprintf( "INSERT INTO film( $id, $tittle, $duration, $language)
|
|
||||||
VALUES ( '%d', '%s', '%d', '%s')",
|
|
||||||
$id, $tittle, $duration, $language);
|
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
@ -33,13 +34,28 @@
|
|||||||
public function allFilmData(){
|
public function allFilmData(){
|
||||||
$sql = sprintf( "SELECT * FROM film ");
|
$sql = sprintf( "SELECT * FROM film ");
|
||||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||||
|
while($fila=mysqli_fetch_array($resul)){
|
||||||
return $resul;
|
$films[] = $this->loadFilm($fila["id"], $fila["tittle"],$fila["duration"],$fila["language"],$fila["description"]);
|
||||||
|
}
|
||||||
|
return $films;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create a new film Data Transfer Object.
|
//Create a new film Data Transfer Object.
|
||||||
public function loadFilm($id, $tittle, $duration, $language){
|
public function loadFilm($id, $tittle, $duration, $language, $description){
|
||||||
return new FilmDTO( $id, $tittle, $duration, $language);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once('film_dto_interface.php');
|
include_once('film_dto_interface.php');
|
||||||
|
class FilmDTO implements Film_DTO {
|
||||||
class Film_DTO implements FilmDTO {
|
|
||||||
|
|
||||||
//Attributes:
|
//Attributes:
|
||||||
private $_id; //Film ID.
|
private $_id; //Film ID.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
interface FilmDTO {
|
interface Film_DTO {
|
||||||
public function setId($id);
|
public function setId($id);
|
||||||
public function getId();
|
public function getId();
|
||||||
public function setTittle($tittle);
|
public function setTittle($tittle);
|
||||||
|
Loading…
Reference in New Issue
Block a user