-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
45 lines (45 loc) · 1.82 KB
/
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
38
39
40
41
42
43
44
45
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
require('connection1.php');
$sql='SELECT * from posts order by id desc';
$prepare=$conn->prepare($sql);
$execute=$prepare->execute();
$result=$prepare->fetchAll();
?>
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
</head>
<body>
<table class="text-center table table-stripped">
<tr>
<th>Title</th>
<th>Description</th>
<th>Created At</th>
<th>Actions</th>
</tr>
<tbody>
<?php
if(!empty($result)){
foreach($result as $row){
?>
<tr>
<td><?php echo $row['post_title'] ?></td>
<td><?php echo $row['description'] ?></td>
<td><?php echo $row['post_at'] ?></td>
<td>
<a href="update.php?id=<?php echo $row['id'] ?>" title='Edit' class='text-decoration-none text-success'><i class="bi bi-pen"></i> Edit</a>  
<a href="remove.php?id=<?php echo $row['id'] ?>" title='Delete' class='text-decoration-none text-danger'><i class="bi bi-trash3-fill"></i> Delete</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</body>
</html>