-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblog - Copie.php
More file actions
36 lines (27 loc) · 1.09 KB
/
Copy pathblog - Copie.php
File metadata and controls
36 lines (27 loc) · 1.09 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
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style_blog.css">
<title>Blog - Spocsk - V1</title>
</head>
<body>
<h1>Blog test Spocsk</h1>
<?php
ini_set('display_errors', TRUE);
$db = new PDO('mysql:host=localhost;dbname=database_name','username','password');
$answer = $db->query('SELECT id, titre, contenu ,DATE_FORMAT(date, \'%d/%m/%Y à %Hh%imin%ss\') AS date_creation FROM blog_post ORDER BY id DESC LIMIT 0,10');
while ($data = $answer->fetch())
{
?>
<div class='news'>
<h3><?php echo $data['titre'] . ' - ' . $data['date_creation'] ?></h3>
<p><?php echo $data['contenu'] ?></p>
<a href="commantaires.php?id_commentaire=<?php echo $data['id']; ?>">Commentaires</a>
</div>
<?php
}
?>
</body>
</html>