-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeletequestion.php
90 lines (70 loc) · 1.91 KB
/
deletequestion.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
include('header.php');
#$userid=isloggedin();
if (isAdmin($userid))
{
$question = $_GET['q'];
/*
if ($userid!=2)
{
exit;
}*/
$sql = "SELECT * FROM proposals WHERE experimentid = ".$question." ";
$response = mysql_query($sql);
while ($row = mysql_fetch_array($response))
{
echo $row[0]."<br>";
echo $row[1]."<br>";
echo $row[2]."<br>";
echo $row[3]."<br>";
echo $row[4]."<br>";
echo $row[5]."<br>";
echo $row[6]."<br>";
echo $row[7]."<br>";
$sql2 = "SELECT * FROM endorse WHERE proposalid = ".$row[0]." ";
$response2 = mysql_query($sql2);
while ($row2 = mysql_fetch_array($response2))
{
echo $row2[0]."<br>";
echo $row2[1]."<br>";
echo $row2[2]."<br>";
echo $row2[3]."<br>";
}
$sql2 = "DELETE FROM endorse WHERE endorse.proposalid = " .$row[0]. " ";
$response2 = mysql_query($sql2);
}
$sql = "DELETE FROM proposals WHERE proposals.experimentid = " .$question. " ";
$response = mysql_query($sql);
$sql3 = "SELECT * FROM updates WHERE question = ".$question." ";
$response3 = mysql_query($sql3);
while ($row3 = mysql_fetch_array($response3))
{
echo $row3[0]."<br>";
echo $row3[1]."<br>";
echo $row3[2]."<br>";
echo $row3[3]."<br>";
}
$sql3 = "DELETE FROM updates WHERE updates.question = " . $question . " ";
$response3 = mysql_query($sql3);
$sql4 = "SELECT * FROM questions WHERE id = ".$question." ";
$response4 = mysql_query($sql4);
while ($row4 = mysql_fetch_array($response4))
{
echo $row4[0]."<br>";
echo $row4[1]."<br>";
echo $row4[2]."<br>";
echo $row4[3]."<br>";
echo $row4[4]."<br>";
echo $row4[5]."<br>";
echo $row4[6]."<br>";
echo $row4[7]."<br>";
}
$sql4 = "DELETE FROM questions WHERE questions.id = " . $question . " ";
$response4 = mysql_query($sql4);
}
else
{
header("Location: login.php");
}
include('footer.php');
?>