Add functions

This commit is contained in:
Daniel Muñoz Garcia 2021-05-26 09:56:54 +02:00 committed by GitHub
parent cf3f36c9d4
commit 4d1eb61a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -42,10 +42,13 @@
//Returns a film data . //Returns a film data .
public function cinemaData($id){ public function cinemaData($id){
$sql = sprintf( "SELECT * FROM cinema WHERE cinema.id = '%d'", $id); $id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM cinema WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$cinema = null; $resul->data_seek(0);
$film = null;
while($fila=$resul->fetch_assoc()){ while($fila=$resul->fetch_assoc()){
$cinema = $this->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]); $cinema = $this->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]);
} }
@ -54,6 +57,14 @@
return $cinema; return $cinema;
} }
public function existCinema($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM cinema WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted film by "id". //Deleted film by "id".
public function deleteCinema($id){ public function deleteCinema($id){
$sql = sprintf( "DELETE FROM cinema WHERE cinema.id = '%d' ;",$id); $sql = sprintf( "DELETE FROM cinema WHERE cinema.id = '%d' ;",$id);

View File

@ -46,6 +46,14 @@
return $film; return $film;
} }
public function existFilm($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM film WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get All the films. //Returns a query to get All the films.
public function allFilmData(){ public function allFilmData(){