This commit is contained in:
Daniel Muñoz Garcia 2021-05-13 20:06:05 +02:00 committed by GitHub
parent 530d51a9c9
commit 39a8ef2ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -8,14 +8,16 @@
private $_duration; //Film duration.
private $_language; //Film language.
private $_description; //Film description.
private $_img;
//Constructor:
function __construct($id, $tittle, $duration, $language, $description){
function __construct($id, $tittle, $duration, $language, $description, $img){
$this->_id = $id;
$this->_tittle = $tittle;
$this->_duration = $duration;
$this->_language = $language;
$this->_description = $description;
$this->_img = $img;
}
//Methods:
@ -31,5 +33,7 @@
public function getLanguage(){return $this->_language;}
public function setDescription($description){ $this->_description = $description;}
public function getDescription(){return $this->_description;}
public function setImg($img){ $this->_img = $img;}
public function getImg(){return $this->_img;}
}
?>

View File

@ -15,10 +15,10 @@
//Methods:
//Create a new Session.
public function createFilm($id, $tittle, $duration, $language, $description){
$sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`)
VALUES ( '%d', '%s', '%d', '%s','%s')",
$id, $tittle, $duration, $language, $description);
public function createFilm($id, $tittle, $duration, $language, $description, $img){
$sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`, `img`)
VALUES ( '%d', '%s', '%d', '%s','%s', '%s')",
$id, $tittle, $duration, $language, $description, $img);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
@ -44,7 +44,7 @@
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]);
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"], $fila["img"]);
}
$resul->free();
return $films;
@ -84,10 +84,10 @@
}
//Edit a film.
public function editFilm($id, $tittle, $duration, $language,$description){
$sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s'
public function editFilm($id, $tittle, $duration, $language,$description,$img){
$sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s', img ='%s'
WHERE film.id = '%d';",
$tittle, $duration, $language, $description, $id);
$tittle, $duration, $language, $description, $img, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -95,8 +95,8 @@
}
//Create a new film Data Transfer Object.
public function loadFilm($id, $tittle, $duration, $language,$description){
return new Film( $id, $tittle, $duration, $language,$description);
public function loadFilm($id, $tittle, $duration, $language,$description, $img){
return new Film( $id, $tittle, $duration, $language,$description, $img);
}
}