-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.php
87 lines (65 loc) · 2.27 KB
/
view.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
<? session_start();
echo "Welcome, " . $_SESSION["username"];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Revolutionary life - Living Stones</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Registration Website">
<meta name="author" content="Samuel Thampy">
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<script src="js/jquery-2.1.0.min.js"></script>
<script>
$(document).ready(function(){
$("#pages").select(function() {
var pages = $( "#pages option:selected" ).val();
alert(pages);
});
});
$(document).ready(function() {
var pages = $( "#pages option:selected" ).val();
$("#results").load("fetch_pages.php", {'page':0,'item_per_page':10}, function() {$("#1-page").addClass('active');});
$(".paginate_click").click(function (e) {
$("#results").prepend('<div class="loading-indication"><img src="img/ajax-loader.gif" /> Loading...</div>');
var clicked_id = $(this).attr("id").split("-");
var page_num = parseInt(clicked_id[0]);
$('.paginate_click').removeClass('active');
$("#results").load("fetch_pages.php", {'page': (page_num-1), 'item_per_page':10}, function(){
});
$(this).addClass('active');
return false; //prevent going to herf link
});
});
</script>
</head>
<body>
<?php
include_once('dbconnect.php');
$result = mysql_query("SELECT * FROM registration_table order by firstname", $link);
$result_count = mysql_query("SELECT count(*) from registration_table", $link);
$get_total_rows = mysql_fetch_array($result_count);
$items_per_page = 10;
$pages = ceil($get_total_rows[0]/$items_per_page);
$pageresult = '';
$pageresult.='<div class="pagination pagination-centered">';
if($pages > 1){
$pageresult.='<ul class="paginate">';
for($i=0; $i < $pages;){
++$i;
$pageresult.='<li><a href="#" class="paginate_click" id="'.$i.'-page">'.$i.'</a></li>';
}
$pageresult.='</ul>';
}
$pageresult.='</div>';
echo $pageresult;
if (!$result) {
die('Error: ' . mysql_error());
}
?>
<span class="out"></span>
<div id="results"></div>
</body>
</html>