-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome1.php
More file actions
206 lines (166 loc) · 7.96 KB
/
home1.php
File metadata and controls
206 lines (166 loc) · 7.96 KB
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
<?php
ini_set('max_execution_time',45);
?>
<!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="shortcut icon" href="../../assets/ico/favicon.ico">
<title>BLRS</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/navbar-fixed-top.css" rel="stylesheet">
<link href="css/search.css" rel="stylesheet">
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">BLRS</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="http://localhost/Dbproject/home1.php">Home</a></li>
<li><a href="http://localhost/Dbproject/about.php">About</a></li>
<li><a href="http://localhost/Dbproject/contact.php">Contact Us</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<!-- <li><a href="../navbar/">Default</a></li>
<li><a href="../navbar-static-top/">Static top</a></li>-->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Options <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="profile.php">Profile</a></li>
<li class="divider"></li>
<li class="dropdown-header"></li>
<li><a href="login.php">Log Out</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div>
<form action="searchresults.php">
<div class="row" style="margin-left:450px" >
<div class="col-lg-3">
<div class="input-group custom-search-form" style="">
<input name="searchtext" type="search" class="form-control" placeholder="Search" autofocus style="-moz-box-sizing: content-box" style="height: 50px">
<span class="input-group-btn">
<button class="btn btn-default" type="submit" style="background-color: #47a447 ">
<span class="glyphicon glyphicon-search"></span>
</button>
</span>
</div>
</div >
</div> <!-- /container -->
</form>
</div>
<div class="row" align="center">
<div class="col-lg-4">
<h2>Most Rated Books!</h2>
<?php
$db = pg_connect("host=localhost dbname=Project user=postgres password=saivignan")
or die('Could not connect: ' . pg_last_error());
if(!$db){
echo "Error : Unable to open database\n";
}
$sql12 ="select isbn,avg(rats) as avrat from rat group by isbn order by avrat desc limit 7;";
$sql="select isbn,av_rats from topbooks_view limit 10";
$ret = pg_query($db, $sql);
if(!$ret){
echo pg_last_error($db);
exit;
}
echo '<table border = "1">';
echo '<tr>' ;
echo '<td> <b> ISBN </b> </td>' ;
echo '<td> <b> Rating </b> </td>' ;
echo '</tr>' ;
while($row = pg_fetch_row($ret)){
echo '<tr>' ;
echo '<td>' ;
$url = '<a href = "bookprofile.php?ISBN='.$row[0].'">' ;
echo $url ;
echo $row[0];
echo "</a>" ;
echo '</td>' ;
echo '<td>' ;
echo $url ;
echo $row[1];
echo "</a>" ;
echo '</td>' ;
echo '</tr>';
}
echo '</table>' ;
?>
</div>
<div class="col-lg-4">
<h2>Most popular authors</h2>
<?php
$sql2="select authorid,authorname from topauthors_view limit 10";
$ret1 = pg_query($db, $sql2);
if(!$ret1){
echo pg_last_error($db);
exit;
}
echo '<table border = "1">';
echo '<tr>' ;
echo '<td> <b> AutorId </b> </td>' ;
echo '<td> <b> Name </b> </td>' ;
echo '</tr>' ;
while($row = pg_fetch_row($ret1)){
echo '<tr>' ;
echo '<td>' ;
$url = '<a href = "authorprofile.php?author_id='.$row[0].'&author_name='.$row[1].'">' ;
echo $url ;
echo $row[0];
echo "</a>" ;
echo '</td>' ;
echo '<td>' ;
echo $url ;
echo $row[1];
echo "</a>" ;
echo '</td>' ;
echo '</tr>';
}
echo '</table>' ;
?>
</div>
<div class="col-lg-4">
<h2>Most popular publishing house</h2>
<?php
$sql23 ="select authorid,authorname from BnA,(select isbn,avg(rats) as avrat from rat group by isbn order by avrat desc)as toprat
where (toprat.isbn=BnA.ISBN )
limit 7; " ;
$sql3="select publication_house from toppublications_view limit 10";
$ret3 = pg_query($db, $sql3);
if(!$ret3){
echo pg_last_error($db);
exit;}
while($row = pg_fetch_row($ret3)){
echo '<a href = "pubprofile.php?p_id='.$row[0].'">' ;
echo ''.$row[0].'';
echo '</br>';
}
pg_close($db);
?>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>