Lo vuelvo a subir
This commit is contained in:
parent
8ae58acce4
commit
1c283b6326
@ -18,7 +18,13 @@
|
||||
$id, $tittle, $duration, $language,$description);
|
||||
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
return $sql;
|
||||
return $resul;
|
||||
}
|
||||
//Returns a film data .
|
||||
public function GetFilm($tittle,$language){
|
||||
$sql = sprintf( "SELECT * FROM film WHERE film.tittle = '%s'AND film.language='%s'", $tittle,$language );
|
||||
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
|
||||
return $resul;
|
||||
}
|
||||
|
||||
//Returns a query to get the film's data.
|
||||
|
@ -46,28 +46,48 @@ class FormFilm extends Form {
|
||||
}
|
||||
|
||||
//Process form:
|
||||
public function processesForm($id,$title,$duration,$languaje,$description, $option) {
|
||||
$this->correct = true;
|
||||
public function processesForm($id,$tittle,$duration,$language,$description, $option) {
|
||||
$this->correct = true;
|
||||
$this->option = $option;
|
||||
|
||||
|
||||
//Habria que validar todo para que encaje en la base de datos
|
||||
|
||||
|
||||
$bd = new Film_DAO('complucine');
|
||||
if($bd ){
|
||||
if($option == "new"){
|
||||
//Primero comprobar si existe una pelicula con el mismo titulo e idioma
|
||||
$bd->createFilm(null, $title,$duration,$languaje,$description);
|
||||
$exist = $bd-> GetFilm($tittle,$language);
|
||||
if( mysqli_num_rows($exist) != 0){
|
||||
$this->correct =false;
|
||||
}
|
||||
else{
|
||||
$bd->createFilm(null, $tittle,$duration,$language,$description);
|
||||
}
|
||||
} else if ($option == "del"){
|
||||
$bd->deleteFilm($id);
|
||||
//Primero comprobar si existe una pelicula con el mismo id
|
||||
$exist = $bd-> FilmData($id);
|
||||
if( mysqli_num_rows($exist) != 0){
|
||||
$bd->deleteFilm($id);
|
||||
}
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
} else if ($option == "edit"){
|
||||
$bd->editFilm($id,$title,$duration,$languaje,$description);
|
||||
//Primero comprobar si existe una pelicula con el mismo id
|
||||
$exist = $bd-> FilmData($id);
|
||||
if( mysqli_num_rows($exist) != 0){
|
||||
$bd->editFilm($id,$tittle,$duration,$language,$description);
|
||||
}
|
||||
else{
|
||||
$this->correct =false;
|
||||
}
|
||||
} else if($this->option == "show") {
|
||||
$this->array = $bd->allFilmData();
|
||||
}
|
||||
} else {$this->correct = false;}
|
||||
|
||||
}
|
||||
|
||||
} else {$this->correct = false;}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user