-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle.php
More file actions
32 lines (27 loc) · 813 Bytes
/
article.php
File metadata and controls
32 lines (27 loc) · 813 Bytes
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
<?php
session_start();
require "database.php";
// *** Selection de l'article demandé ***
$query = $bdd -> prepare(
"SELECT id, titre, description, image, date_creation
FROM articles
WHERE id = ? && publie = 1");
$query -> execute(array($_GET['id']));
$article = $query -> fetch();
// *** Affichage des commentaires publié de l'article ***
$query = $bdd -> prepare(
"SELECT pseudo, commentaire, id_article, date
FROM commentaires
WHERE id_article = ? && publie = 1");
$query -> execute(array($_GET['id']));
$commentaires = $query -> fetchAll();
// *** Incrémentation du nb de visites ***
$query=$bdd->prepare(
"UPDATE articles
SET nb_visites = nb_visites + 1
WHERE id = ?");
$query->execute(array($_GET['id']));
include "header.php";
include "phtml/article.phtml";
include "footer.php";
?>