forked from if-itb/IF3110-2015-T1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
67 lines (67 loc) · 1.77 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php include_once("header.php");
include_once("functions.php");
?>
<div class="search-area">
<center>
<form method="get" action="search.php" id="search">
<input type="text" id="search-box" name="s">
<input type="submit" id="search-submit" value="Search">
</form>
<div id="search-desc">
Cannot find what you are looking for. <a href="ask.php">Ask here</a>.
</div>
</center>
</div>
<div class="content">
<div id="recent-title">Recently Asked Questions</div>
<hr>
<?php
$con = connectDB();
$result = getAllQuestions();
?>
<div class="question-list">
<?php
if ($result->num_rows > 0){
while($row = $result->fetch_assoc()) {
$id = $row["id"];
?>
<div class="question-item" id="question-<?php echo $id;?>">
<table>
<tr>
<td>
<?php echo $row["votes"];?></br>
Votes
</td>
<td>
<?php echo countAnswers($id);?></br>
Answers
</td>
</td>
<td>
<?php echo "<a class=\"question-item-topic\" href=\"view.php?q=".$row["id"]."\"?><strong>".$row["topic"]."</strong></a></br>".$row["content"];?>
<div class="question-item-tag">
<?php echo "Asked by <span class='question-item-name'>" . $row["name"]."</span>";
echo " | ";
echo "<a href='edit.php?q=" .$id. "'>edit</a>";
echo " | ";
echo "<a class=''><span onclick='delQuestion(".$id.",true)' class='question-item-delete'>delete</span></a>";
?>
</div>
</td>
</tr>
</table>
<hr>
<?php
?>
</div>
<?php
}
} else {
echo "No results";
}
?>
</div>
</div>
</div>
</body>
</html>