Skip to content

Commit

Permalink
Clean up formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Burgin committed Apr 19, 2018
1 parent 60c412f commit afc8c90
Show file tree
Hide file tree
Showing 7 changed files with 325 additions and 325 deletions.
130 changes: 65 additions & 65 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,72 @@
<html>

<head>
<title>Homework #8</title>
<link rel="stylesheet" href="/~jsburgin/style.css" />
<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>
<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>
</html>
88 changes: 44 additions & 44 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
body {
font-family: 'Helvetica', sans-serif;
margin: 0;
padding: 0;
text-align: center;
font-family: 'Helvetica', sans-serif;
margin: 0;
padding: 0;
text-align: center;
}

table {
border-collapse: collapse;
margin: 0 auto;
border-collapse: collapse;
margin: 0 auto;
}

th, td {
border: 1px solid #000;
padding: 5px 10px;
font-weight: normal;
border: 1px solid #000;
padding: 5px 10px;
font-weight: normal;
}

h3 {
margin: 0 0 10px;
margin: 0 0 10px;
}

.section {
text-align: center;
padding: 25px 0;
border-bottom: 1px solid #eee;
overflow: auto;
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;
width: 150px;
margin-bottom: 10px;
height: 28px;
font-size: 15px;
}

input {
text-indent: 8px;
text-indent: 8px;
}

button {
margin-bottom: 15px;
margin-bottom: 15px;
}

form {
width: 260px;
margin: 0 auto;
width: 260px;
margin: 0 auto;
}

.form-group {
width: 100%;
text-align: left;
float: left;
clear: both;
width: 100%;
text-align: left;
float: left;
clear: both;
}

.form-group label {
float: left;
clear: both;
margin-bottom: 5px;
float: left;
clear: both;
margin-bottom: 5px;
}

.form-group input {
float: left;
clear: both;
width: 100%;
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;
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;
}
display: inline-block;
margin-top: 20px;
}
94 changes: 47 additions & 47 deletions task3.php
Original file line number Diff line number Diff line change
@@ -1,55 +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);
}
<?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" />
<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 } ?>
<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>
</html>
Loading

0 comments on commit afc8c90

Please sign in to comment.