-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbooklist.php
executable file
·157 lines (117 loc) · 3.7 KB
/
booklist.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
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
<?php
require('includes/config.php');
session_start();
$cat=$_GET['subcatid'];
$totalq="select count(*) \"total\" from book where b_subcat='$cat'";
$totalres=mysqli_query($conn,$totalq) or die("Can't Execute Query...");
$totalrow=mysqli_fetch_assoc($totalres);
$page_per_page=6;
$page_total_rec=$totalrow['total'];
$page_total_page=ceil($page_total_rec/$page_per_page);
if(!isset($_GET['page']))
{
$page_current_page=1;
}
else
{
$page_current_page=$_GET['page'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include("includes/head.inc.php");
?>
</head>
<body>
<!-- start header -->
<div id="header">
<div id="menu">
<?php
include("includes/menu.inc.php");
?>
</div>
</div>
<div id="logo-wrap">
<div id="logo">
<?php
include("includes/logo.inc.php");
?>
</div>
</div>
<!-- end header -->
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h1 class="title"><?php echo $_GET['subcatnm'];?></h1>
<div class="entry">
<table border="4" width="100%" >
<br><br><br><br><br>
<?php
$k=($page_current_page-1)*$page_per_page;
$query="select *from book where b_subcat='$cat' LIMIT ".$k .",".$page_per_page;
$res=mysqli_query($conn,$query) or die("Can't Execute Query...");
$count=0;
while($row=mysqli_fetch_assoc($res))
{
if($count==0)
{
echo '<tr>';
}
echo '<td valign="top" width="20%" align="center">
<a href="detail.php?id='.$row['b_id'].'&cat='.$_GET['subcatnm'].'">
<img src="'.$row['b_img'].'" width="80" height="100">
<br>'.$row['b_nm'].'</a>
</td>';
$count++;
if($count==2)
{
echo '</tr>';
$count=0;
}
}
?>
</table>
<br><br><br>
<center>
<?php
if($page_total_page>$page_current_page)
{
echo '<a href="booklist.php?subcatid='.$_GET['subcatid'].'&subcatnm='.$_GET['subcatnm'].'&page='.($page_current_page+1).'">Next</a>';
}
for($i=1;$i<=$page_total_page;$i++)
{
echo ' <a href="booklist.php?subcatid='.$_GET['subcatid'].'&subcatnm='.$_GET['subcatnm'].'&page='.$i.'">'.$i.'</a> ';
}
if($page_current_page>1)
{
echo '<a href="booklist.php?subcatid='.$_GET['subcatid'].'&subcatnm='.$_GET['subcatnm'].'&page='.($page_current_page-1).'">Previous</a>';
}
?>
</center>
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebar -->
<div id="sidebar">
<?php
include("includes/search.inc.php");
?>
</div>
<!-- end sidebar -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
<?php
include("includes/footer.inc.php");
?>
</div>
<!-- end footer -->
</body>
</html>