-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
37 lines (33 loc) · 974 Bytes
/
index.php
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
<!DOCTYPE html>
<html lang="ru">
<head>
<?php
$website_title = 'PHP блог';
require 'blocks/head.php';
?>
</head>
<body>
<?php require 'blocks/header.php'; ?>
<main class="container mt-5">
<div class="row">
<div class="col-md-8 mb-3">
<?php
require_once 'mysql_connect.php';
$sql = 'SELECT * FROM `articles` ORDER BY `date` DESC';
$query = $pdo->query($sql);
while($row = $query->fetch(PDO::FETCH_OBJ)) {
echo "<h2>$row->title</h2>
<p>$row->intro</p>
<p><b>Автор статьи:</b> <mark>$row->avtor</mark></p>
<a href='/news.php?id=$row->id' title='$row->title'>
<button class='btn btn-warning mb-5'>Прочитать больше</button>
</a>";
}
?>
</div>
<?php require 'blocks/aside.php'; ?>
</div>
</main>
<?php require 'blocks/footer.php'; ?>
</body>
</html>