-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
149 lines (127 loc) · 5.27 KB
/
index.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
<!doctype html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Online Foram</title>
<style>
.content {
margin:0 auto;
width: 50%;
}
</style>
</head>
<body class="content">
<?php include 'parshial/header.php' ?>
<!-- show error -->
<!-- stard slider -->
<div class="form-control">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="https://images.unsplash.com/photo-1503437313881-503a91226402?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTd8fGNvZGV8ZW58MHx8MHx8&auto=format&fit=crop&w=5000&q=600" width="1500" height="440" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://images.unsplash.com/photo-1566837945700-30057527ade0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=5000&q=60" width="800" height="440" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="https://images.unsplash.com/photo-1534972195531-d756b9bfa9f2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTF8fGNvZGV8ZW58MHx8MHx8&auto=format&fit=crop&w=5000&q=60" width="1000" height="440" alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="container my-4">
<!-- this is card body -->
<div class="container my-4">
<h1 class="text-center my-1">Online Foram</h1>
<!-- <div class="row center my-3 text-center" > -->
<!-- fetch all the category here -->
<!-- <div class="card-center">
<div class="row center my-3 text-center" > -->
<div class="row">
<?php
include 'parshial/dbconnection.php';
$limit = 3;
if (isset($_GET['page'])) {
$page =$_GET['page'];
}else{
$page = 1;
}
$offset = ($page - 1) * $limit;
$sql = "SELECT * FROM `category` order by category_id desc limit {$offset},{$limit} ";
$result = mysqli_query($connection, $sql);
while ($row = mysqli_fetch_assoc($result)) {
$catid=$row['category_id'];
$cat=$row['category_name'];
$description=$row['category_description'];
$image=$row['image'];
echo '
<div class="col-md-4 my-2">
<p><div class="card" style="width: 18rem;">
<img src="'.$image.'"class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title"><a href ="thredlist.php?catid='.$catid.'">'.$cat.'</a></h5>
<p class="card-text">'.substr($description,0, 120).'....</p>
<a href="thredlist.php?catid='.$catid.'" class="btn btn-primary">Thred View</a>
</div>
</div></p>
</div>
';
}
?>
</div>
<?php
$sqli="SELECT * FROM `category`";
$query=mysqli_query($connection , $sqli);
if (mysqli_num_rows($query) > 0) {
$total_record = mysqli_num_rows($query);
$total_pages = ceil($total_record / $limit);
echo '<nav aria-label="Page navigation example">';
echo '<ul class = "pagination justify-content-center">';
if ($page > 1) {
echo '<li class="page-item ">
<a class="page-link" href="index.php?page='.($page - 1).'" tabindex="-1">Previous</a>
</li>';
}
for ($i=1; $i <= $total_pages ; $i++) {
if ($i == $page) {
$active = "active";
}else{
$active ="";
}
echo '<li class="page-item '.$active.'"><a class="page-link" href="index.php?page='.$i.'">'.$i.'<span class="sr-only">(current)</a></li>';
}
if ($total_pages >$page) {
echo '<li class="page-item">
<a class="page-link" href="index.php?page='.($page + 1).'">Next</a>
</li>';
}
echo '</nav>';
echo '</ul>';
}
?>
</div></div>
<!-- footer linked here -->
<?php include 'parshial/footer.php' ?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>