-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
630 lines (519 loc) · 28.7 KB
/
index.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
<?php
//Report all PHP errors
error_reporting(E_ALL);
ini_set('display_errors', 'On');
//Connect to database
$mysqli = new mysqli("oniddb.cws.oregonstate.edu","niderk-db","8qV5RXYryvcPMSf8","niderk-db");
/* check connection */
if (mysqli_connect_errno()) {
echo "Connection error " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
<html>
<head><title>CS 275 Project: NHL Database for 2007/2008 Season</title>
<link type="text/css" rel="stylesheet" href="db.css" media="all" />
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
<script type="text/javascript" src="db.js"></script>
</head>
<body>
<h1>CS 275 Project: NHL Database for 2007/2008 Season</h1>
<h1>Kevin Nider & Bental Wong</h1>
<h2><a href="javascript: void(0)" id="addQueryOpenButton" style="display: inline"><img src="addbutton.png" style="display:inline" /> Add Queries</a> <a href="javascript: void(0)" id="addQueryCloseButton" style="display: none;"><img src="minusbutton.png" style="display: inline" /> Add Queries</a></h2>
<div class="query" id="addQuery" style="display:none;">
<form method="post" action="addteam.php" id="addTeam">
<fieldset id="addQuery" class="queryForm">
<legend>Add a Team</legend>
<div class="formRow">
<label for="teamID">Team ID (3 letter initials)<span class="required">*</span></label> <input type="text" value="" maxlength="3" minlength="3" size="3" id="teamID" name="teamID" title="Team ID must be 3 letters long and contain only letters." class="required blockInput" />
</div>
<div class="formRow">
<label for="teamName">Team Name<span class="required">*</span></label> <input type="text" value="" title="Please complete this field." maxlength = "100" size="25" id="teamName" name="teamName" class="required blockInput" />
</div>
<div class="formRow">
<label for="stadiumName">Stadium Name</label> <input type="text" value="" maxlength = "100" size="25" id="stadiumName" name="stadiumName" class="blockInput" />
</div>
<div class="formRow">
<label for="City">City</label> <input type="text" value="" maxlength = "100" size="25" id="city" name="city" class="blockInput" />
</div>
<div class="formRow">
<label for="state">State</label> <select name="state" id="state" class="blockInput"><option value="">Select a state</option><option value="AL">Alabama</option><option value="AK">Alaska</option><option value="AS">American Samoa</option><option value="AZ">Arizona</option><option value="AR">Arkansas</option>
<option value="CA">California</option><option value="CO">Colorado</option><option value="CT">Connecticut</option><option value="DE">Delaware</option><option value="DC">D.C.</option><option value="FL">Florida</option>
<option value="GA">Georgia</option><option value="GU">Guam</option><option value="HI">Hawaii</option><option value="ID">Idaho</option><option value="IL">Illinois</option><option value="IN">Indiana</option><option value="IA">Iowa</option><option value="KS">Kansas</option><option value="KY">Kentucky</option><option value="LA">Louisiana</option>
<option value="ME">Maine</option><option value="MD">Maryland</option><option value="MA">Massachusetts</option><option value="MI">Michigan</option><option value="MN">Minnesota</option>
<option value="MS">Mississippi</option><option value="MO">Missouri</option><option value="MT">Montana</option><option value="NE">Nebraska</option><option value="NV">Nevada</option><option value="NH">New Hampshire</option><option value="NJ">New Jersey</option><option value="NM">New Mexico</option><option value="NY">New York</option>
<option value="NC">North Carolina</option><option value="ND">North Dakota</option><option value="OH">Ohio</option><option value="OK">Oklahoma</option><option value="OR">Oregon</option><option value="PA">Pennsylvania</option>
<option value="PR">Puerto Rico</option><option value="RI">Rhode Island</option><option value="SC">South Carolina</option><option value="SD">South Dakota</option><option value="TN">Tennessee</option><option value="TX">Texas</option><option value="UT">Utah</option><option value="VT">Vermont</option><option value="VI">Virgin Islands</option>
<option value="VA">Virginia</option><option value="WA">Washington</option><option value="WV">West Virginia</option><option value="WI">Wisconsin</option><option value="WY">Wyoming</option>
<option value=""></option><option value="AB">Alberta</option><option value="BC">British Columbia</option><option value="MB">Manitoba</option><option value="NB">New Brunswick</option><option value="NF">Newfoundland</option><option value="NS">Nova Scotia</option><option value="ON">Ontario</option>
<option value="PI">Prince Edward Island</option><option value="QB">Quebec</option><option value="SK">Saskatchewan</option></select>
</div>
<div class="formRow">
<label for="country">Country</label> <select name="country" id="country" class="blockInput"><option value="">Select a country</option><option value="Canada">Canada</option><option value="United States">United States</option></select>
</div>
<div class="clear" ></div>
<input type="submit" name="addteam" value="Add Team" />
</fieldset>
</form>
<form method="post" action="addplayer.php" id="addPlayer">
<fieldset id="addQuery" class="queryForm">
<legend>Add a Player</legend>
<div class="formRow">
<label for="firstName">First Name<span class="required">*</span></label> <input type="text" value="" title="Please complete this field." maxlength="100" size="25" id="firstName" name="firstName" class="required blockInput" />
</div>
<div class="formRow">
<label for="lastName">Last Name<span class="required">*</span></label> <input type="text" value="" title="Please complete this field." maxlength="100" size="25" id="lastName" name = "lastName" class="required blockInput" />
</div>
<div class="formRow">
<label for="jerseyNum">Jersey Number<span class="required">*</span></label> <input type="number" value="" title="Please enter a number between 1 and 99." size="2" id="jerseyNum" name="jerseyNum" class="required blockInput" />
</div>
<div class="formRow">
<label for="position">Position<span class="required">*</span></label> <select title="Please complete this field." name="position" id="position" class="required blockInput"><option value="">Select a position</option><option value="C">Center</option><option value="L">Left Wing</option><option value="R">Right Wing</option><option value="D">Defense</option><option value="G">Goalie</option></select>
</div>
<fieldset>
<legend>Team #1:</legend>
<div class="formRow">
<label for="playerteamName1">Team Name<span class="required">*</span></label> <!--<input type="text" value="" title="Please complete this field." size="25" id="playerteamName" class="required blockInput" />-->
<select name="playerteamName1" id="playerteamName1" class="required blockInput" title="Please complete this field."><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
#echo "Execute failed ". $stmt->errno . " " . $stmt->error;
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="startDate1">Start Date<span class="required">*</span> (YYYY-MM-DD)</label> <input type="date" value="" min="2007-09-29" max="2008-04-06" title="Date must be within 2007/2008 season." id="startDate1" name="startDate1" class="required blockInput" />
</div>
</fieldset>
<fieldset>
<legend>Team #2 (If player was traded during the season):</legend>
<div class="formRow">
<label for="playerteamName2">Team Name</label>
<select name="playerteamName2" id="playerteamName2"><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
#echo "Execute failed ". $stmt->errno . " " . $stmt->error;
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="startDate2">Start Date (YYYY-MM-DD)</label> <input type="date" value="" min="2007-09-29" max="2008-04-06" title="Date must be within 2007/2008 season." id="startDate2" name="startDate2"/>
</div>
</fieldset>
<br />
<div class="clear" ></div>
<input type="submit" name="addplayer" value="Add Player" />
</fieldset>
</form>
<form method="post" action="addgame.php" id="addGame">
<fieldset id="addQuery" class="queryForm">
<legend>Add a Game</legend>
<div class="formRow">
<label for="homeTeam">Home Team<span class="required">*</span></label>
<select name="homeTeam" id="homeTeam" class="required blockInput" title="Please complete this field."><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="awayTeam">Away Team<span class="required">*</span></label>
<select name="awayTeam" id="awayTeam" class="required blockInput" title="Please complete this field."><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="gameDate">Game Date<span class="required">*</span> (YYYY-MM-DD)<input type="date" class="required blockInput" value="" min="2007-09-29" max="2008-04-06" title="Date must be within 2007/2008 season. (2007-09-29 - 2008-04-06)" id="gameDate" name="gameDate"/>
</div>
<div class="formRow">
<label for="gameStatus">Game Status<span class="required">*</span></label> <select name="gameStatus" id="gameStatus" class="required blockInput"><option value="">Select a status</option><option value="RT">Regular time</option><option value="OT">Overtime</option><option value="SO">Shootout</option></select>
</div>
<fieldset>
<legend>Game Stats:</legend>
<div class="formRow">
<label for="homeShots">Home Shots<span class="required">*</span></label> <input type="number" value="" title="Please enter a number between 0 and 100." size="3" id="homeShots" name="homeShots" class="required blockInput" />
</div>
<div class="formRow">
<label for="awayShots">Away Shots<span class="required">*</span></label> <input type="number" value="" title="Please enter a number between 0 and 100." size="3" id="awayShots" name="awayShots" class="required blockInput" />
</div>
<div class="formRow">
<label for="homePenaltyMin">Home Penalty Minutes<span class="required">*</span></label> <input type="number" value="" title="Please enter a number between 0 and 200." size="3" id="homePenaltyMin" name="homePenaltyMin" class="required blockInput" />
</div>
<div class="formRow">
<label for="awayPenaltyMin">Away Penalty Minutes<span class="required">*</span></label> <input type="number" value="" title="Please enter a number between 0 and 200." size="3" id="awayPenaltyMin" name="awayPenaltyMin" class="required blockInput" />
</div>
</fieldset>
<div class="clear" ></div><br>
<input type="submit" name="addgame" id="addgame" value="Add Game" />
</fieldset>
</form>
<!--
<form method="post" action="javascript: void(0)" id="addGoal">
<fieldset id="addQuery" class="queryForm">
<legend>Add a Goal</legend>
<div class="formRow">
<label for="shotDate">Date<span class="required">*</span> (YYYY-MM-DD)</label> <input type="text" value="" title="Date must be within 2007/2008 season (2007-09-29 - 2008-04-06)." size="25" id="shotDate" class="required blockInput" />
</div>
<div class="formRow">
<label for="shotTeamName">Team Name<span class="required">*</span></label>
<select name="shotTeamName" id="shotTeamName" class="required blockInput"><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
#echo "Execute failed ". $stmt->errno . " " . $stmt->error;
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="takenBy">Taken By<span class="required">*</span></label>
<select name="takenBy" id="takenBy" class="required blockInput"><option value="">Select a player</option>
<?php
//get player ID, first and last names
if(!($stmt = $mysqli->prepare("SELECT TEAMS.teamID, PLAYERS.playerID, PLAYERS.firstName, PLAYERS.lastName FROM PLAYERS INNER JOIN PLAYERS_TEAMS ON PLAYERS.playerID = PLAYERS_TEAMS.playerID INNER JOIN TEAMS ON TEAMS.teamID = PLAYERS_TEAMS.teamID"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed ". $stmt->errno . " " . $stmt->error;
}
if(!($stmt->bind_result($teamID, $playerID, $firstName, $lastName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $playerID . '">' . $teamID . ' - ' . $firstName . ' ' . $lastName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="period">Period<span class="required">*</span></label> <select name="Period" id="period" class="required blockInput">
<option value="">Select a Period</option><option value="1">1st Period</option><option value="2">2nd Period</option><option value="3">3rd Period</option><option value="4">Overtime</option>
<option value="5">Shootout</option></select>
</div>
<div class="formRow">
<label for="elapsedTime">Elapsed Time<span class="required">*</span> (MM:SS)</label> <input type="number" value="" size="25" id="elapsedTime" class="required blockInput" />
</div>
<div class="formRow">
<label for="teamStr">Team Strength<span class="required">*</span></label> <select name="Team Strength" id="teamStr" class="required blockInput">
<option value="EV">Even Strength</option><option value="PP">Power Play</option><option value="SH">Shorthanded</option></select>
</div>
<div class="clear" ></div>
<input type="submit" name="addGoal" id="addGoal" value="Add Goal" />
</fieldset>
</form>
-->
<!--Change later
<form method="post" action="javascript: void(0)" id="addAssist">
<fieldset id="addQuery" class="queryForm">
<legend>Add Assists</legend>
<div class="formRow">
<label for="goalID">Goal ID<span class="required">*</span></label> <input type="number" value="" title="Please complete this field." size="25" id="shotID" class="required blockInput" />
</div>
<div class="formRow">
<label for="player1">Player Name<span class="required">*</span></label> <input type="text" value="" size="25" id="player1" class="required blockInput" />
</div>
<div class="formRow">
<label for="player2">Player Name</label> <input type="text" value="" size="25" id="player2" class="blockInput" />
</div>
<div class="clear" ></div>
<input type="submit" name="addAssist" id="addAssist" value="Add Assist" />
</fieldset>
</form>
-->
<form method="post" action="addaward.php" id="addAward">
<fieldset id="addQuery" class="queryForm">
<legend>Add an Award</legend>
<div class="formRow">
<label for="trophyName">Trophy Name<span class="required">*</span></label>
<select name="trophyName" id="trophyName" class="required blockInput" title="Please complete this field." ><option value="">Select an award</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT trophyID, trophyName FROM AWARDS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($trophyID, $trophyName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $trophyID . '">' . $trophyName . '</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="awardPlayer1">Player Name<span class="required">*</span></label>
<select id="awardPlayer1" name="awardPlayer1" class="required blockInput" title="Please select a player"><option value="">Select a player</option>
<?php
//get player ID, first and last names
if(!($stmt = $mysqli->prepare("SELECT TEAMS.teamID, PLAYERS.playerID, PLAYERS.firstName, PLAYERS.lastName, PLAYERS.position FROM PLAYERS INNER JOIN PLAYERS_TEAMS ON PLAYERS.playerID = PLAYERS_TEAMS.playerID INNER JOIN TEAMS ON TEAMS.teamID = PLAYERS_TEAMS.teamID"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed ". $stmt->errno . " " . $stmt->error;
}
if(!($stmt->bind_result($teamID, $playerID, $firstName, $lastName, $position))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $playerID . '">' . $teamID . ' - ' . $firstName . ' ' . $lastName . ' (' . $position . ')</option>';
}
?>
</select>
</div>
<div class="formRow">
<label for="awardPlayer2">2nd Player Name</label>
<select id="awardPlayer2" name="awardPlayer2" class="blockInput"><option value="">Select a player</option>
<?php
//get player ID, first and last names
if(!($stmt = $mysqli->prepare("SELECT TEAMS.teamID, PLAYERS.playerID, PLAYERS.firstName, PLAYERS.lastName, PLAYERS.position FROM PLAYERS INNER JOIN PLAYERS_TEAMS ON PLAYERS.playerID = PLAYERS_TEAMS.playerID INNER JOIN TEAMS ON TEAMS.teamID = PLAYERS_TEAMS.teamID"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed ". $stmt->errno . " " . $stmt->error;
}
if(!($stmt->bind_result($teamID, $playerID, $firstName, $lastName, $position))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $playerID . '">' . $teamID . ' - ' . $firstName . ' ' . $lastName . ' (' . $position . ')</option>';
}
?>
</select>
</div>
<div class="clear" ></div>
<br />
<input type="submit" name="addAward" id="addAward" value="Add Award" />
</fieldset>
</form>
</div> <!-- /addQuery -->
<div class="clear" ></div>
<h2><a href="javascript: void(0)" id="selectQueryOpenButton"><img src="addbutton.png" style="display: inline" /> Select Queries</a> <a href="javascript: void(0)" id="selectQueryCloseButton" style="display: none;"><img src="minusbutton.png" style="display: inline" /> Select Queries</a></h2>
<div class="query" id="selectQuery" style="display: none;">
<div class="queryForm">
<form method="post" action="teams.php" id="teams">
<fieldset id="selectQuery" class="queryForm" style="clear: none; width: auto; margin-right:20px;">
<legend>Show Teams</legend>
<div class="clear" ></div>
<br>
<input type="submit" name="teamsSubmit" value="Show All Teams" />
</fieldset>
</form>
<form method="post" action="players.php" id="players">
<fieldset id="selectQuery" class="queryForm" style="clear: none; width: auto; margin-right:20px;">
<legend>Show Players</legend>
<div class="clear" ></div>
<br>
<input type="submit" name="playersSubmit" value="Show All Players" />
</fieldset>
</form>
<form method="post" action="games.php" id="games">
<fieldset id="selectQuery" class="queryForm" style="clear: none; width: auto; margin-right:20px;">
<legend>Show Games</legend>
<div class="clear" ></div>
<br>
<input type="submit" name="gamesSubmit" value="Show All Games" />
</fieldset>
</form>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="queryForm">
<form method="post" action="playerstats.php" id="playerStats">
<fieldset id="selectQuery" class="queryForm">
<legend>Player Stats</legend>
<div class="formRow">
<label for="playerStatsID">Player Name<span class="required">*</span></label>
<select name="playerStatsID" id="playerStatsID" class="required blockInput"><option value="">Select a player</option>
<?php
//get player ID, first and last names, but exclude goalies since no stats available for goalies.
if(!($stmt = $mysqli->prepare("SELECT TEAMS.teamID, PLAYERS.playerID, PLAYERS.firstName, PLAYERS.lastName FROM PLAYERS INNER JOIN PLAYERS_TEAMS ON PLAYERS.playerID = PLAYERS_TEAMS.playerID INNER JOIN TEAMS ON TEAMS.teamID = PLAYERS_TEAMS.teamID where PLAYERS.position <> 'G'"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed ". $stmt->errno . " " . $stmt->error;
}
if(!($stmt->bind_result($teamID, $playerID, $firstName, $lastName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $playerID . '">' . $teamID . ' - ' . $firstName . ' ' . $lastName . '</option>';
}
?>
</select>
</div>
<div class="clear" ></div>
<input type="submit" name="playerstats" id="playerStatsButton" value="Show Player Stats" />
</fieldset>
</form>
<div class="clear"></div>
</div>
<div class="clear"></div>
<div class="queryForm query">
<fieldset id="selectQuery" class="queryForm">
<legend>Game Stats</legend>
<form method="post" action="gamestats.php" id="gameStats">
<div class="formRow">
<label for="gameStatsDate">Game Date<span class="required">*</span> (YYYY-MM-DD)</label> <input onchange="updateFields()" type="Date" value="" min="2007-09-29" max="2008-04-06" title="Please complete this field." size="25" id="gameStatsDate" name="gameStatsDate" class="required blockInput" />
</div>
<div class="formRow">
<label for="gameStatsTeamName">Team Name<span class="required">*</span></label>
<select name="gameStatsTeamName" id="gameStatsTeamName" nameclass="gameStatsTeamName" ="required blockInput" onchange="updateFields()"><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="clear" ></div>
<input type="submit" name="scoringSummary" id="scoringSummaryButton" value="Show Scoring Summary" style="margin-right:20px; float:left;" />
</form>
<form method="post" action="teamsummary.php" id="teamSummary">
<input type="hidden" value="" id="teamSummaryDate" name="teamSummaryDate" class="required blockInput" />
<input type="hidden" value="" id="teamSummaryTeam" name="teamSummaryTeam" class="required blockInput" />
<input type="submit" name="teamSummary" id="teamSummaryButton" value="Show Team Summary" style="float: left;"/>
</form>
</fieldset>
<!--<div id="scoringSummaryTable" class="statsTable" style="display: none;">
<table id="scoringSummary">
<tr><td>Period</td><td>Team</td><td>Goal By:</td><td>Assisted By:</td><td>Team Strength</td></tr>
<tr><td>['period']</td><td>['team']</td><td>['goalBy']</td><td>['assistBy']</td><td>['teamStr']</td></tr>
</table>
</div> <!-- /scoringSummarytable -->
<!--<div id="teamSummaryTable" class="statsTable" style="display: none;">
<table id="teamSummary">
<tr><td>Goals For</td><td>Goals Against</td><td>Shots For</td><td>Shots Against</td></tr>
<tr><td>['goalsfor']</td><td>['goalsagainst']</td><td>['shotsfor']</td><td>['shotsagainst']</td></tr>
</table>
</div> <!-- /teamSummarytable -->
</div>
<div class="queryForm">
<form method="post" action="standings.php" id="teamStandings"><!--Change later-->
<fieldset id="selectQuery" class="queryForm">
<legend>Team Standings</legend>
<div class="formRow">
<label for="teamStandingsName" style="width: 320px;">Team Name (or select no team for all team standings)</label>
<select name="teamStandingsName" id="teamStandingsName" class="required blockInput"><option value="">Select a team</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT teamID, teamName FROM TEAMS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($teamID, $teamName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $teamID . '">' . $teamName . '</option>';
}
?>
</select>
</div>
<div class="clear" ></div>
<input type="submit" name="teamStandings" id="teamStandingsButton" value="Show Team Standings" />
</fieldset>
</form>
<!--<div id="teamStandingsTable" class="statsTable" style="display: none;">
<table id="teamStandings">
<tr><td>Team Name</td><td>Games Played</td><td>Wins</td><td>Losses</td><td>OT Losses</td><td>Points</td><td>Home Record</td><td>Away Record</td></tr>
<tr><td>['teamName']</td><td>['gamesPlayed']</td><td>['wins']</td><td>['losses']</td><td>['OTLosses']</td><td>['points']</td><td>['homeRecord']</td><td>['awayRecord']</td></tr>
</table>
</div> <!-- /teamStandingsTable -->
</div>
<form method="post" action="awards.php" id="showAward">
<fieldset id="selectQuery" class="queryForm">
<legend>Show Awards</legend>
<div class="formRow">
<label for="trophyName">Award Name<span class="required">*</span></label>
<select name="trophyName" id="trophyName" class="required blockInput" title="Please complete this field." ><option value="">Select an award</option>
<?php
if(!($stmt = $mysqli->prepare("SELECT trophyID, trophyName FROM AWARDS"))){
echo "Prepare failed: " . $stmt->errno . " " . $stmt->error;
}
if(!($stmt->execute())) {
echo "Execute failed: " . $mysqli->connect_errno . " " . $mysqli->connect_error;
}
if(!($stmt->bind_result($trophyID, $trophyName))){
echo "Bind failed: " . $stmt->errno . " " . $stmt->error;
}
while($stmt->fetch()){
echo '<option value="'. $trophyID . '">' . $trophyName . '</option>';
}
?>
</select>
</div>
<div class="clear" ></div>
<input type="submit" name="showAward" id="showAward" value="Show Awardees" />
</fieldset>
</form>
</div> <!-- /select Query -->
</body>
</html>