-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joshua Burgin
committed
Apr 19, 2018
1 parent
781c29b
commit 60c412f
Showing
9 changed files
with
423 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!doctype html> | ||
|
||
<html> | ||
|
||
<head> | ||
<title>Homework #8</title> | ||
<link rel="stylesheet" href="/~jsburgin/style.css" /> | ||
</head> | ||
|
||
<body> | ||
<div class="section"> | ||
<h3>Task 3</h3> | ||
<p>View all tables and tuples in the database</p> | ||
<a href="/~jsburgin/task3.php" class="button">View Tables</a> | ||
</div> | ||
<div class="section"> | ||
<h3>Task 4a</h3> | ||
<h4>Query 1: Songs</h4> | ||
<p>This query shows a list of songs from a particular genre. Select a genre below.</p> | ||
<form action="/~jsburgin/task4a-songs.php" method="POST"> | ||
<select name="genre"> | ||
<option value="Rock">Rock</option> | ||
<option value="Pop">Pop</option> | ||
<option value="Funk">Funk</option> | ||
<option value="Disco">Disco</option> | ||
<option value="Jazz">Jazz</option> | ||
<option value="Country">Country</option> | ||
<option value="Rap">Rap</option> | ||
</select> | ||
<br /> | ||
<button type="submit" class="button">Run Query</button> | ||
</form> | ||
|
||
<h4>Query 2: Records & Artists</h4> | ||
<p>This query shows a list of records joined with their artists. Enter a year below to show all records that have come out since then.</p> | ||
<form action="/~jsburgin/task4a-records.php" method="POST"> | ||
<input type="text" name="year" placeholder="Enter a year"/> | ||
<br /> | ||
<button type="submit" class="button">Run Query</button> | ||
</form> | ||
</div> | ||
<div class="section"> | ||
<h3>Task 4b</h3> | ||
<h4>Adding Employees</h4> | ||
<p>This form adds a new employee to the database. Enter employee details below:</p> | ||
<form action="/~jsburgin/task4b.php" method="POST"> | ||
<div class="form-group"> | ||
<label>SSN:</label> | ||
<input type="text" placeholder="123-45-6789" name="ssn" /> | ||
</div> | ||
<div class="form-group"> | ||
<label>Name:</label> | ||
<input type="text" placeholder="John Doe" name="name" /> | ||
</div> | ||
<div class="form-group"> | ||
<label>Address:</label> | ||
<input type="text" placeholder="42 Wallaby Way" name="address" /> | ||
</div> | ||
<div class="form-group"> | ||
<label>Title:</label> | ||
<input type="text" placeholder="Manager" name="title" /> | ||
</div> | ||
<button type="submit" href="/~jsburgin/task1.php" class="button">Add Employee</button> | ||
</form> | ||
<h4>Query Employees</h4> | ||
<p>This query searches for employees by name. Enter a search term below to query.</p> | ||
<form action="/~jsburgin/task4b-search.php" method="POST"> | ||
<input type="text" name="name" placeholder="e.g. John"/> | ||
<br /> | ||
<button type="submit" class="button">Run Query</button> | ||
</form> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
body { | ||
font-family: 'Helvetica', sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
text-align: center; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
margin: 0 auto; | ||
} | ||
|
||
th, td { | ||
border: 1px solid #000; | ||
padding: 5px 10px; | ||
font-weight: normal; | ||
} | ||
|
||
h3 { | ||
margin: 0 0 10px; | ||
} | ||
|
||
.section { | ||
text-align: center; | ||
padding: 25px 0; | ||
border-bottom: 1px solid #eee; | ||
overflow: auto; | ||
} | ||
|
||
select, input { | ||
width: 150px; | ||
margin-bottom: 10px; | ||
height: 28px; | ||
font-size: 15px; | ||
} | ||
|
||
input { | ||
text-indent: 8px; | ||
} | ||
|
||
button { | ||
margin-bottom: 15px; | ||
} | ||
|
||
form { | ||
width: 260px; | ||
margin: 0 auto; | ||
} | ||
|
||
.form-group { | ||
width: 100%; | ||
text-align: left; | ||
float: left; | ||
clear: both; | ||
} | ||
|
||
.form-group label { | ||
float: left; | ||
clear: both; | ||
margin-bottom: 5px; | ||
} | ||
|
||
.form-group input { | ||
float: left; | ||
clear: both; | ||
width: 100%; | ||
} | ||
|
||
.button { | ||
background: #6AC2D7; | ||
padding: 10px 15px; | ||
color: #fff; | ||
display: inline-block; | ||
text-decoration: none; | ||
border-radius: 5px; | ||
font-size: 16px; | ||
border: none; | ||
clear: both; | ||
} | ||
|
||
a.return-link { | ||
display: inline-block; | ||
margin-top: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
$user = "jsburgin"; | ||
$cwid = "11484207"; | ||
$server = "cs-sql2014.ua-net.ua.edu"; | ||
// create the connection to mySQL | ||
$con = new mysqli($server, $user, $cwid, $user); | ||
$tables = $con->query("SHOW TABLES"); | ||
|
||
function getRows($con, $tname) { | ||
return $con->query("SELECT * FROM " . $tname); | ||
} | ||
|
||
function getColumns($con, $tname) { | ||
return $con->query("SHOW COLUMNS FROM ". $tname); | ||
} | ||
?> | ||
|
||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Task 3</title> | ||
<link href="/~jsburgin/style.css" rel="stylesheet" /> | ||
</head> | ||
|
||
<body> | ||
<a href="/~jsburgin" class="return-link">Return to Main Page</a> | ||
<?php | ||
while ($table = mysqli_fetch_row($tables)) { | ||
$columns = getColumns($con, $table[0]); | ||
$rows = getRows($con, $table[0]); ?> | ||
|
||
<div class="section"> | ||
<h3><?php echo $table[0] ?></h3> | ||
<table> | ||
<thead> | ||
<tr> | ||
<?php while ($column = mysqli_fetch_row($columns)) { ?> | ||
<th><?php echo $column[0]; ?></th> | ||
<?php } ?> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php while ($row = mysqli_fetch_row($rows)) { ?> | ||
<tr> | ||
<?php foreach($row as $value) {?> | ||
<td><?php echo $value ?></td> | ||
<?php } ?> | ||
</tr> | ||
<?php } ?> | ||
</tbody> | ||
</table> | ||
</div> | ||
<?php } ?> | ||
</body> | ||
</html> |
Oops, something went wrong.