-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
83 lines (65 loc) · 3.45 KB
/
profile.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
<html>
<head>
<title>MyMovieBooking</title>
<link rel="stylesheet" href="styles.css?v=<?php echo time(); ?>">
</head>
<body>
<?php
include 'header.php';
?>
<div class="body-content">
<div id="book-movie">
<?php
$userID = $_SESSION['userID'];
$mid = $_SESSION['mv_id'];
include 'includes/config.php';
// $sel = "SELECT * FROM movies where movieID = '$mid'";
// $rs = $conn->query($sel);
// while($rws = $rs->fetch_assoc()){
?>
<!-- <?php ?> -->
<?php
include 'includes/config.php';
$sel = "SELECT *
FROM ticket
LEFT JOIN movies
ON ticket.movieID = movies.movieID
WHERE ticket.userid = '$userID' ";
$rs = $conn->query($sel);
if ($rs->num_rows > 0) {
echo '<h1>Your Ticket :</h1> <br />';
echo '<a href="index.php">Book another ticket?</a>';
while($rws = $rs->fetch_assoc()){
$tID =(int) $rws['ticketID'];
// var_dump($tID);
echo '<div class="ticket">';
echo ' <div id="movie-img">
<img id="image-id" src="images/'. $rws['image'].'" width="200" height="200">
</div>';
echo '<div id="ticket-details">';
echo "<table>";
echo "<tr><td>BOOKING ID </td><td>: 91yXwq3889uiop".$rws['ticketID'] ."</td></tr><tr><td>SCREEN </td><td>: ".$rws["screen"]."</td></tr><tr><td>SEATS </td><td>: ".$rws["seat"]."</td></tr><tr><td>DATE </td><td>: ".$rws['bdate']."</td></tr><tr></tr> <td>TIME </td><td>: ".$rws['btime']."</td></tr>";
echo '<form method="POST">';
echo '<button id="cancel-btn" type="submit" name="cancel" >Cancel Ticket</button>';
echo '</form>';
echo "</table>";
echo '<h1 id="movie-title">'.$tID.'</h1>';
echo '</div>';
echo '</div>';
if(isset($_POST['cancel'])){
include 'includes/config.php';
$qry = "DELETE FROM `ticket` WHERE `ticket`.`ticketID` = '$tID'";
$result = $conn->query($qry);
break;
}
}
}
else {
echo 'You haven\'t yet booked any tickets! <br />';
echo '<a href="index.php">Book now?</a>';
}
?>
</div>
</div>
</body>
</html>