Add functions
This commit is contained in:
parent
cf3f36c9d4
commit
4d1eb61a1e
@ -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);
|
||||||
|
@ -47,6 +47,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(){
|
||||||
$sql = sprintf( "SELECT * FROM film ");
|
$sql = sprintf( "SELECT * FROM film ");
|
||||||
|
Loading…
Reference in New Issue
Block a user