forked from steventrux/Lottery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclosed_lotto.php
40 lines (29 loc) · 1.08 KB
/
closed_lotto.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
<?php
include '/include/config.php';
$mysqli = new mysqli("$host", "$user", "$pass", "lottery");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$sql_open = "SELECT *
FROM lottery.lotteries
WHERE lottery.lotteries.open = 0
ORDER BY lottery.lotteries.id ASC";
$result_open = $mysqli->query($sql_open);
$row_cnt = $result_open->num_rows;
if( $row_cnt > 0 ){
while ($row = $result_open->fetch_array(MYSQLI_ASSOC)){
echo '<h1><a href = "lottery.php?id='.$row['id'].'">'.$row['name'].'</a></h1>';
echo 'Lottery Reason: '.$row['reason'].'</br>Ticket Price: '.number_format($row['ticketCost']).'</br>Tickets: '.number_format($row['ticketNum']).'</br>Tickets Left: '.number_format($row['ticketLeft']).'</br>';
if ($row['winner'] > 0) {
echo 'Winner: Announced</br>';
} else {
echo 'Winner: Pending....</br>';
}
echo '<a href="'.$row['forumLink'].'" target="_blank">EvE Forum Link</a></br><a href="'.$row['diceLink'].'" target="_blank">Dice Link</a></br>';
}
} else {
echo '<center><h1>No Closed Lotteries!</h1></center>';
}
?>