Skip to content

Commit

Permalink
style ratings
Browse files Browse the repository at this point in the history
  • Loading branch information
maggiyang committed Jan 28, 2015
1 parent 70d6f2f commit 6d5921a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 13 deletions.
72 changes: 62 additions & 10 deletions ratings.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>Ratings</title>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="starter-template.css" rel="stylesheet">

</head>
<body>

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="index.php">Home</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>

<?php

//check if genre info is available otherwise redirect
Expand Down Expand Up @@ -33,22 +72,35 @@
$statement->bindParam(1, $like);
$statement->execute(); //executes statement
$titles = $statement->fetchAll(PDO::FETCH_OBJ);
//var_dump($titles); //dump info on any variable

echo "DVD titles with $rating rating";

?>

<?php if ($statement->rowCount() > 0) : ?>

<div class="container">
<div class="starter-template">
<h1>Here are DVD titles with "<?php echo $rating ?>" rating</h1>
<table class="table table-hover">
<tr>
<th>Title</th>
</tr>
<?php foreach($titles as $title) :?>
<div>
<br><?php echo $title->title ?>
</div>
<tr>
<td><?php echo $title->title ?></td>
</tr>
<?php endforeach ?>
</table>
<a href="index.php">Return to search menu</a>
</div>
</div>
<?php else : ?>
<br>
<p>This rating did not match any results</p>
<a href="index.php">Return to search menu</a>
<?php endif ?>
<div class="container">
<div class="starter-template">
<p>This rating did not match any results</p>
<a href="index.php">Return to search menu</a>
</div>
</div>
<?php endif ?>

</body>
</html>
11 changes: 8 additions & 3 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<div class="container">
<div class="starter-template">
<h1>You searched for "<?php echo $dvd ?>"</h1>
<tbod>
<table class="table table-hover">
<tr>
<th>Title</th>
Expand All @@ -104,11 +105,15 @@
</tr>
<?php endforeach ?>
</table>
</tbod>
<a href="index.php">Return to search menu</a>
</div>
</div>
<?php else : ?>
<br>
<p>Your search did not match any results</p>
<a href="index.php">Return to search menu</a>
<div class="container">
<div class="starter-template">
<p>Your search did not match any results</p>
<a href="index.php">Return to search menu</a>
</div>
</div>
<?php endif ?>
Expand Down

0 comments on commit 6d5921a

Please sign in to comment.