-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_data.php
31 lines (21 loc) · 1018 Bytes
/
get_data.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
<?php
$host = "host = localhost";
$port = "port = 5432";
$dbname = "dbname = werewolf";
$credentials = "user = postgres";
$db = pg_connect( "$host $port $dbname $credentials");
if(!$db) {
echo "Error : Unable to open database\n";
} else {
echo "<p> <font color=darkblue> If the player is a villager/a special villager, put your dumb up (👍); If the player is a werewolf, put your dumb down ( 👎). </font> </p> ";
}
$query_one= "SELECT werewolf_one, werewolf_two, werewolf_three, whitewerewolf FROM whitewerewolf WHERE TIME='night1';";
$ret = pg_query($db,$query_one);
while ($row = pg_fetch_row($ret)) {
if (empty($row[0]) & empty($row[1]) & empty($row[2]) & empty($row[3])) {
echo "<p> <font color=darkblue> Please recheck if you have submitted your results on the first night. </font> </p>";
} else {
echo "<p> <font color=darkblue> The four werewolves are $row[0], $row[1], $row[2], and $row[3].</font> </p> ";
}
}
?>