-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenre.php
More file actions
89 lines (75 loc) · 2.99 KB
/
genre.php
File metadata and controls
89 lines (75 loc) · 2.99 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
$recup_tous = mysqli_query($mysqli, "
SELECT f.id AS idfilm, f.letitre, f.ladesc, f.lannee,
r.lenom, r.leprenom,
GROUP_CONCAT(g.id) AS idgenre,
GROUP_CONCAT(g.lintitule SEPARATOR '|||') AS lintitule,
(SELECT concat(i.lurl)
FROM allo_images i
WHERE i.film_id = f.id LIMIT 1
) as monimage,
(SELECT GROUP_CONCAT(a.leprenom,' ',a.lenom SEPARATOR ' | ' )
FROM allo_acteur a
INNER JOIN allo_film_has_acteur fha
ON a.id = fha.acteur_id
WHERE f.id = fha.film_id
) as acteur
FROM allo_film f
LEFT JOIN allo_genre_has_film ghf
ON f.id = ghf.film_id
LEFT JOIN allo_genre g
ON g.id = ghf.genre_id
INNER JOIN allo_realisateur r
ON f.realisateur_id = r.id
WHERE g.id = $idgenre
GROUP BY f.id
;
");
$genrefilms = mysqli_query($mysqli, "SELECT * FROM allo_genre WHERE id = $idgenre");
$affiche_genre = mysqli_fetch_assoc($genrefilms);
$nb = mysqli_num_rows($recup_tous);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="style.css" />
<link href='https://fonts.googleapis.com/css?family=Josefin+Sans:400,600,700' rel='stylesheet' type='text/css'>
<title>Bienvenue sur AllezCiné</title>
</head>
<body>
<div>
<?php
include 'menu.php';
?>
</div>
<section>
<h1><?=$affiche_genre['lintitule']?></h1>
<?php
// si $nb est vide (=>0)
if (empty($nb)) {
echo "<article><h2>Le cinéma manque d'oeuvres !</h2></article>";
// sinon (on a au moins 1 article)
} else {
while ($ligne = mysqli_fetch_assoc($recup_tous)) {
?><article><?php
echo "<img src='".$ligne['monimage']."'/>" ;
echo "<h2>" . $ligne['letitre'] . "</h2>";
echo "<p><strong>Date de sortie</strong> : " . $ligne['lannee'] . " | <strong>Réalisé par</strong> " . $ligne['leprenom'] . " " . $ligne['lenom'] . "<br/>";
// Pour l'affichage des ACTEURS
$lesacteurs = ""; // création de la chaine vide
// on va transformer les chaines de caractère des sections en tableaux indexés
$actid = explode(', ',$ligne['acteur']);
// affichage de la liste des sections en utilisant 1 seul foreach
foreach($actid AS $clef => $valeur){
$lesacteurs.= $ligne['acteur'] ;
}
echo "<strong>Avec</strong> : " . $lesacteurs . "</p>";
echo "<p>" . substr($ligne['ladesc'], 0, 150) . "... ";
echo "<a href='?idarticle=" . $ligne['idfilm'] . "'>Lire la suite</a></p></article><hr/>";
}
}
?></section>
</body>
</html>