-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmanagerviewpicnic.php
181 lines (144 loc) · 3.2 KB
/
managerviewpicnic.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<html>
<head>
<title>View Picnic</title>
<style type="text/css">
#bookLink{
background:url(images/but1.jpg) repeat-x;
text-decoration:none;
width:150px;
height:40px;
font:28px cursive bold ;
display: block;
color:#FFFFFF;
text-shadow:1px 1px 2px #77A200;
border-radius:10px;
text-align:center;
padding:5px;
margin:5px;
}
#bookLink:hover{
background:url(images/but2.jpg) repeat-x;
text-decoration:none;
width:150px;
height:40px;
font:28px cursive bold ;
display: block;
color:#FFFFFF;
text-shadow:1px 1px 5px #000;
border-radius:10px;
text-align:center;
padding:5px;
margin:5px;
}
th{background-color: #25BBE8;
color:#FFFFFF;
text-shadow:1px 1px 2px #000;
font:18px cursive bold ;
}
table
{
width: 100%; border: 3px black solid; border-collapse: collapse;
}
tr:nth-of-type(odd) { background-color: #ccc; }
tr:nth-of-type(even) { background-color: #F4F2FB; }
#reference {
border-bottom:1px solid #cccccc;
padding-bottom: 2px;
}
#reference:visited {
color: #09C;
text-decoration: none;
}
#reference:hover {
color: #333333;
border-bottom:3px solid #AD3417;
padding-bottom: 2px;
text-decoration: none;
}
#reference:active {
color: #006;
text-decoration: none;
}
#reference:link {
text-decoration: none;
}
#mytable{
width:100%;
text-align:center;
}
/********************************************************************/
</style>
</head>
<body>
<h1>View Picnics</h1>
<?php
//connect to the database where $dbcon
require('globalvar.php');
include('init.php');
unset($_SESSION['picnicid']);
unset($_SESSION['placeid']);
if (!$dbcon) {
die('Could not connect: ' . mysql_error());
}
//echo 'Connected successfully';
//mysql_close($dbcon);
mysql_select_db($DB_NAME);
$query=
"SELECT
picnics.id ,
picnics.`depature time`,
picnics.`arrive time`,
picnics.`return time`,
picnics.place,
picnics.title,
picnics.priceperperson
FROM `picnics`".
" ORDER BY
picnics.id ASC";
$result=mysql_query($query,$dbcon) or die("<h3 style='color:red;'>error getting data</h3>"); // query first "SELECT * FROM `picnics`;";
$num_rows=mysql_num_rows($result);
echo "$num_rows results found";
$stringeod=<<< EOD
<form>
EOD;
echo $stringeod;
echo "<table id='mytable'>";
echo "<tr><th>Reference #</th><th>Depature time</th><th>Arrive time</th><th>Return time</th><th>Place</th><th>Description</th><th>Price</th><th>Select</th></tr>";
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
echo "<tr><td>";
echo "<a id='reference' href='"."psessionmanager.php?pcid=".$row['id']."&plid=".$row['place']."' >".$row['id']."</a>";//1
echo "</td><td>";
echo $row['depature time'];//2
echo "</td><td>";
echo $row['arrive time'];//3
echo "</td><td>";
echo $row['return time'];//4
echo "</td><td>";
echo getplacename($row['place']);//5
echo "</td><td>";
echo $row['title'];//6
echo "</td><td>";
echo $row['priceperperson'];//7
echo "</td><td>";
echo "<a id='bookLink' href='"."psessionmanager.php?pcid=".$row['id']."&plid=".$row['place']."' >";
echo "View</a>";
echo "</td></tr>";
}
echo "</table>";
echo "</form>";
function getplacename($r){
$query="SELECT
place.`name`,
place.id
FROM `place`
WHERE
place.id=".$r." ;";
if($query_run=mysql_query($query))
{
return mysql_result($query_run,0,'name');
}
}
?>
</body>
</html>