-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuser_viewbak.php
93 lines (85 loc) · 2.39 KB
/
user_viewbak.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
<?php
session_start();
if(session_id()=='' || isset($_SESSION['username'])){
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "1234";
$dbname = "coffeecorner";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$user = $_SESSION['username'];
$sql = "(SELECT * FROM add_reservation WHERE username like '$user')";
$result = mysqli_query($connection, $sql);
if(!$result)
{
die("database query fail!" . mysqli_error($connection) . mysqli_errno($connection));
}
//header("location: user_dashboard.php");
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User | View Reservation</title>
<link href="user_view.css" rel="stylesheet" type="text/css">
</head>
<body>
<h2 class="h2">Coffee Corner</h2>
<h3 class="details">Reservation Details</h3>
<nav class="navbar">
<ul class="ul">
<li class="dashboard"><a href="user_dashboard.php">Dashboard</a></li>
<li class="add"><a href="user_addreservation.php">Make a reservation</a></li>
<li class="view"><a href="user_view.php">View Reservation</a></li>
<li class="update"><a>Update Reservation</a></li>
<li class="delete"><a>Delete Reservation</a></li>
<li class="border-bottom"><a></a></li>
</ul>
</nav>
<p class="credential">Logged in as : <?php echo $_SESSION['username']; ?></p>
<a class="button_logout" href="logout.php" name="logout">Log out</a>
<div class=details_box>
<?php
$results=mysql_query($sql,$connection);
$row = array();
echo "<table width=\"200\" border=\"1\" cellspacing=\"0px\" cellpadding=\"10px\">";
echo "<tbody>";
echo "<tr>";
echo "<td>Name</td>";
echo "<td>Number of people</td>";
echo "<td>Date</td>";
echo "<td>Time</td>";
echo "<td>Status</td>";
echo "</tr>";
while($rows[]=mysql_fetch_array($results))
{
echo "<tr>";
echo "<td>$user</td>";
echo "<td></td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
}
?>
<p><?php echo "Customer name: " . $user; ?></p>
<p><?php
//while($row = mysqli_fetch_assoc($result))
{
//var_dump($row);
echo "Number of people: " . $row["no_of_people"] . "</br><br>";
echo "Date: " . $row["date"] . "</br><br>";
echo "Time: " . $row["time"] . "</br><br>";
}
?></p>
</div>
</body>
<?php
}
else
{
header("location: login.php");
}
?>
</html>