-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreply.php
65 lines (56 loc) · 1.62 KB
/
reply.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
<?php
include("connection.php");
session_start();
$uid=$_SESSION['empid'];
$qid=$_SESSION['qid'];
$answer=$_POST['reply'];
$SQL="INSERT INTO answer (quesid,ans,userid) VALUES ('$qid','$answer','$uid')";
$result=$conn->query($SQL);
if($result==0)
echo "The data has not been entered";
else
echo "The data has been entered";
$SQL1="SELECT user FROM question WHERE qid=$qid";
// $resultone=$conn->query($SQL1);
$time_left = mysqli_query($conn,$SQL1);
// if($resultone==0)
if(mysqli_num_rows($time_left)==0)
echo "The data has not been entered";
else
echo "The data has been entered";
$row=mysqli_fetch_assoc($time_left);
$user=$row["user"];
echo $user;
$SQL2="SELECT email FROM emp WHERE empid='$user'";
// $result2=$conn->query($SQL2);
// if($result2==0)
$time_left2 = mysqli_query($conn,$SQL2);
// if($resultone==0)
if(mysqli_num_rows($time_left2)==0)
echo "The data has not been entered";
else
echo "The data has been entered";
$row2=mysqli_fetch_assoc($time_left2);
$mailid=$row2["email"];
echo $mailid;
$SQL3="SELECT quest FROM question WHERE qid=$qid";
// $resultone=$conn->query($SQL1);
$time_left3 = mysqli_query($conn,$SQL3);
// if($resultone==0)
if(mysqli_num_rows($time_left3)==0)
echo "The data has not been entered";
else
echo "The data has been entered";
$row3=mysqli_fetch_assoc($time_left3);
$question=$row3["quest"];
echo $question;
if ($uid!=$user) {
# code...
$msg=$uid." has replied to your question:\n".$question."\nKindly log in back to Eclipse to view your replies.";
$msg = wordwrap($msg,70);
echo $msg;
mail($mailid,"Eclipse Notification",$msg);
}
$conn ->close();
header("Location: question.php?subject=$qid")
?>