-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.php
More file actions
72 lines (65 loc) · 1.77 KB
/
Copy pathfunction.php
File metadata and controls
72 lines (65 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
global $bdd;
$bdd = new PDO('mysql:host=localhost;dbname=cinefile;charset=utf8', 'root', 'mysql');
function getBlock($file, $data = [])
{
require $file;
}
class Person
{
function getAllBaseInfos(){
global $bdd;
$reponse = $bdd->query('SELECT * FROM person');
$data = $reponse->fetchAll();
return $data;
}
function getBaseInfos($lastname){
global $bdd;
$sql = 'SELECT *
FROM person
WHERE lastname < :lastname';
$sth = $bdd->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':lastname' => "$lastname"));
$data = $sth->fetchAll();
return $data;
}
}
class Director extends Person{
function getAllDirectors(){
global $bdd;
$reponse = $bdd->query(
'SELECT DISTINCT person.* FROM person,movieHasPerson
WHERE person.id=movieHasPerson.idPerson AND movieHasPerson.role="Realisateur"');
$data = $reponse->fetchAll();
return $data;
}
}
class Actor extends Person{
function getAllActors(){
global $bdd;
$reponse = $bdd->query(
'SELECT DISTINCT person.* FROM person,movieHasPerson
WHERE person.id=movieHasPerson.idPerson AND movieHasPerson.role="Acteur"');
$data = $reponse->fetchAll();
return $data;
}
}
class Movie
{
function getAllMovies(){
global $bdd;
$reponse = $bdd->query(
'SELECT title FROM movie'
);
$data = $reponse->fetchAll();
return $data;
}
function getBaseInfos(){
global $bdd;
$reponse = $bdd->query(
'SELECT * FROM movie'
);
$data = $reponse->fetchAll();
return $data;
}
}