-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
33 lines (29 loc) · 964 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
<?php
include 'header.php';
?>
<form action="search.php" method="POST">
<input type="text" name="search" placeholder="Search">
<button type="submit" name="submit-search">Search</button>
</form>
<h1>Frotn page</h1>
<h2>All articles:</h2>
<div class="article-container">
<?php
$sql = "SELECT * FROM article";
$result = mysqli_query($conn, $sql);
$queryResults = mysqli_num_rows($result);
// echo $queryResults;
if($queryResults > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "<div class='article-box'>
<h3>".$row['a_title']."</h3>
<p>".$row['a_text']."</p>
<p>".$row['a_date']."</p>
<p>".$row['a_author']."</p>
</div>";
}
}
?>
</div>
</body>
</html>