This repository has been archived by the owner on Aug 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_handler.php
96 lines (82 loc) · 2.52 KB
/
event_handler.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
91
92
93
94
95
96
<?php
//$q = $_REQUEST["question"];
//$a = $_REQUEST["answer"];
//$c = $_REQUEST["button"];
include("db.php");
$query = 'SELECT * FROM test_table WHERE testId = 2';
$query = $db->prepare($query);
$query->execute();
$results = $query->get_result();
$r= $results->fetch_assoc();
$b = $r['testValue'];
if ($b == "no_update") {
$query = 'UPDATE test_table SET testValue="yes_update" WHERE testId = 2';
$query = $db->prepare($query);
$query->execute();
$query = 'SELECT * FROM test_table WHERE testId = 1';
$query = $db->prepare($query);
$query->execute();
$results = $query->get_result();
$r= $results->fetch_assoc();
$n = $r['testValue'];
if ($n == "yes") {
$query = 'UPDATE test_table SET testValue="no" WHERE testId = 1';
$query = $db->prepare($query);
$query->execute();
echo "no";
} else {
$query = 'UPDATE test_table SET testValue="yes" WHERE testId = 1';
$query = $db->prepare($query);
$query->execute();
echo "yes";
}
} else {
$query = 'UPDATE test_table SET testValue="no_update" WHERE testId = 2';
$query = $db->prepare($query);
$query->execute();
$query = 'SELECT * FROM test_table WHERE testId = 1';
$query = $db->prepare($query);
$query->execute();
$results = $query->get_result();
$r= $results->fetch_assoc();
$n = $r['testValue'];
echo $n;
}
//
//
//
//$query = 'SELECT * FROM test_table WHERE testId = 1';
//$query = $db->prepare($query);
//$query->execute();
//$results = $query->get_result();
//$r= $results->fetch_assoc();
//$b = $r['testValue'];
//
//$query = 'UPDATE test_table SET testValue="no_update" WHERE testId = 2';
//$query = $db->prepare($query);
//$query->execute();
//
//if ($b == "yes") {
// $query = 'UPDATE test_table SET testValue="no" WHERE testId = 1';
// $query = $db->prepare($query);
// $query->execute();
// echo "no";
//// $query = 'UPDATE test_table SET testValue="no_update" WHERE testId = 2';
//// $query = $db->prepare($query);
//// $query->execute();
//} else {
// $query = 'UPDATE test_table SET testValue="yes" WHERE testId = 1';
// $query = $db->prepare($query);
// $query->execute();
// echo "yes";
//// $query = 'UPDATE test_table SET testValue="no_update" WHERE testId = 2';
//// $query = $db->prepare($query);
//// $query->execute();
//}
$results->free();
$db->close();
//echo "test";
//Whatever is echo'd is like the return from a function
//echo $q." is equal to ".$a;
//echo "BRO, YOU FIGURED OUT AJAX";
//echo $b.".";