-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (79 loc) · 3.66 KB
/
index.html
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
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<title>Le Parisien</title>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header><a href="index.php"><img class= "header-img" alt="Article image" src="Le_Parisien_logo.svg" height="50"></a></header>
<nav>
<ul>
<li><a class="nav" href="index.php">HOME</a></li>
<li><a class="nav" href="kategorija.php?id=sport">SPORT</a></li>
<li><a class="nav" href="kategorija.php?id=kultura">KULTURA</a></li>
<li><a class="nav" href="unos.php">NOVI ČLANAK</a></li>
</ul>
</nav>
<main>
<?php
$dbc = mysqli_connect('localhost','root','','vijesti') or
die("Connection failed: ". mysqli_connect_error());
$query = "SELECT * FROM clanak WHERE arhiva=1 AND kategorija='sport' LIMIT 3";
$result = mysqli_query($dbc,$query) or
die("Error querying database");
while($row = mysqli_fetch_array($result)) {
$id[] = $row['id'];
$naslov[] = $row['naslov'];
$sazetak[] = $row['sazetak'];
$sadrzaj[] = $row['sadrzaj'];
$kategorija[] = $row['kategorija'];
$arhiva[] = $row['arhiva'];
$datum[] = $row['datum'];
$slika[] = "img/".$row['slika'];
}
echo '<h2>SPORT</h2>
<article class="first">
<img class="article-lft" alt="Article image" width = "250" height="150" src="'.$slika[0].'">
<h3 class="article-lft"><a href=clanak.php?id="'.$id[0].'"> '.$naslov[0].'</a></h3>
</article>
<article>
<img class="article-mid" alt="Article image" width = "250" height="150" src="'.$slika[1].'">
<h3 class="article-mid">'.$naslov[1].'</h3>
</article>
<article>
<img class="article-rgt" alt="Article image" width = "250" height="150" src="'.$slika[2].'">
<h3 class="article-rgt">'.$naslov[2].'</h3>
</article>';
$query = "SELECT * FROM clanak WHERE arhiva=1 AND kategorija='kultura' LIMIT 3";
$result = mysqli_query($dbc,$query) or
die("Error querying database");
while($row = mysqli_fetch_array($result)) {
$naslov[] = $row['naslov'];
$sazetak[] = $row['sazetak'];
$sadrzaj[] = $row['sadrzaj'];
$kategorija[] = $row['kategorija'];
$arhiva[] = $row['arhiva'];
$datum[] = $row['datum'];
$slika[] = "img/".$row['slika'];
}
echo '<h2>KULTURA</h2>
<article class="first">
<img class="article-lft" alt="Article image" width = "250" height="150" src="'.$slika[3].'">
<h3 class="article-lft">'.$naslov[3].'</h3>
</article>
<article>
<img class="article-mid" alt="Article image" width = "250" height="150" src="'.$slika[4].'">
<h3 class="article-mid">'.$naslov[4].'</h3>
</article>
<article>
<img class="article-rgt" alt="Article image" width = "250" height="150" src="'.$slika[5].'">
<h3 class="article-rgt">'.$naslov[5].'</h3>
</article>';
?>
</main>
<footer>
<p>Marin Jurišić, [email protected], 2020.</p>
</footer>
</body>
</html>