-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
75 lines (66 loc) · 2.72 KB
/
user.php
File metadata and controls
75 lines (66 loc) · 2.72 KB
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
<?php
include './partials/_header.php';
include './partials/_dbconnect.php';
?>
<div class="container my-4">
<h1 style="margin-bottom: 10px;">Your Threads</h1>
<?php
$thread_user_id=$_SESSION['sno'];
$sql = "SELECT * FROM threads WHERE thread_user_id=$thread_user_id";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result))
{
$thread_title = $row['thread_title'];
$thread_desc = $row['thread_description'];
$thread_id = $row['thread_id'];
$thread_time=$row['timestamp'];
$thread_user_id=$row['thread_user_id'];
// Printing existing threads
echo '
<div class="d-flex my-3">
<div class="flex-shrink-0">
<img src="./Images/userdefault.jfif" alt="..." width="34px" height="34px">
</div>
<div class="flex-grow-1 ms-3">
<h5 class="mt-0"><a href="thread.php?threadid=' . $thread_id . '" class="text-dark" style="text-decoration: none;">' . $thread_title . '</a></h5>
' . $thread_desc . '
<p class="font-weight-bold my-0">Asked at '. $thread_time.'</b></p>
</div>
</div>';
}
?>
</div>
<div class="container my-4">
<h1 style="margin-bottom: 10px;">Your Comments</h1>
<?php
$thread_user_id=$_SESSION['sno'];
$sql = "SELECT * FROM comments WHERE comment_by=$thread_user_id";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result))
{
$comment_content = $row['comment_content'];
$thread_time = $row['comment_time'];
$query2="SELECT * FROM threads WHERE thread_user_id=$thread_user_id";
$result2=mysqli_query($conn,$query2);
// Printing existing threads
while($roww=mysqli_fetch_assoc($result2))
{
$thread_id=$roww['thread_id'];
$thread_title=$roww['thread_title'];
$thread_desc=$roww['thread_description'];
$thread_time=$roww['timestamp'];
echo '
<div class="d-flex my-3">
<div class="flex-shrink-0">
<img src="./Images/userdefault.jfif" alt="..." width="34px" height="34px">
</div>
<div class="flex-grow-1 ms-3">
<h5 class="mt-0"><a href="thread.php?threadid=' . $thread_id . '" class="text-dark" style="text-decoration: none;">'. $thread_title . '</a></h5><b> Thread Description : </b>
' . $thread_desc . '
<p class="font-weight-bold my-0"><b> Your comment :</b> '.$comment_content.'</b><br> at '. $thread_time .' </p>
</div>
</div>';
}
}
?>
</div>