-
Notifications
You must be signed in to change notification settings - Fork 0
/
questions.php
34 lines (34 loc) · 867 Bytes
/
questions.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
<?php
include_once("functions.php");
$conn = get_connection_handle();
if(isset($_GET['limit'])){
$limit = $_GET['limit'];
}else{
$limit = 25;
}
$query = $conn->query("select * from questions order by id DESC LIMIT $limit");
if($query->num_rows > 0){
echo '
<div class="card p-4">
<h1 class="card-title">All questions</h1>
<table class="table table-bordered table-responsive-md">
<thead>
<th>Question</th>
<th>Asked by</th>
<th>Tags</th>
<th>Date</th>
</thead>
<tbody>';
while($row = $query->fetch_object()){
$list = <<<LOVE
<tr>
<td>$row->question</td>
<td>$row->asked_by</td>
<td>$row->tags</td>
<td>$row->added_on</td>
</tr>
LOVE;
echo $list;
}
echo "</tbody></table></div>";
}