-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-genres.php
91 lines (83 loc) · 3.27 KB
/
get-genres.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
<?php
require_once 'db-connect.php';
$queryString = 'SELECT * FROM tblGenres ORDER BY genreName;';
$myConn->set_query_string($queryString);
$result = $myConn->execute_query();
if (!$result)
die ('The query failed for some reason');
$genres = $myConn->get_first_result(RETURN_OBJECT);
$num_rows = $myConn->get_number_of_returned_rows();
session_start();
unset($_SESSION['wish']);
unset($_SESSION['cart']);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Volga/Genres</title>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Raleway:400,600,800" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
</head>
<body>
<div class="inner">
<form class="left" id="searchBar" method="post" action="books.php">
<input class="left" type="text" name="muse" id="search"/>
<select class="left" id="searchOptions" name="category" size="1">
<option selected>Title</option>
<option>Author</option>
<option>Isbn</option>
</select>
<input class="left" type="submit" id="searchButton" value="SEARCH"/>
</form>
<p class="account right"><?php
if(!$_SESSION["name"]){
echo '<a class="login" href="login.html">Login</a>';
} else {
echo 'Hello, ' . $_SESSION["name"] . "     <a class='login' href='cart.php'>Cart</a>     <a class='login' href='wishlist.php'>Wishlist</a>     <a class='login' href='logout.php?href=get-genres.php'>Logout</a>";
}
?>
</p>
<a id="logo" href="index.php">
<h1>Volga</h1>
</a>
</div>
<header>
<nav class="inner">
<!-- Start nav list-->
<ul>
<li>
<a href="index.php">
Home
</a>
</li><li>
<a href="books.php">
Books
</a>
</li><li>
<a href="get-genres.php">
Genres
</a>
</li>
</ul><!-- End nav list -->
</nav>
</header>
<!-- Start inner Div -->
<div class="inner">
<div class="genre">
<?php echo '<a href="books.php?id=' . $genres->genreId . '"><h3>' . $genres->genreName . '</h3></a>';
$genres = $myConn->get_next_result(RETURN_OBJECT); ?>
</div>
<?php
for ($i = 1; $i < $num_rows; $i++) {
echo '<div class="spacerSmall"></div>
<div class="genre">
<a href="books.php?id=' . $genres->genreId . '"><h3>' . $genres->genreName . '</h3></a>
</div>';
$genres = $myConn->get_next_result(RETURN_OBJECT);
}
?>
</div><!-- End inner -->
</body>
</html>