Pagination werkt niet 100%
Code (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
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
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
<html>
<head>
<title>Candan Creations</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/table_background.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor=#FFFFFF leftmargin=0 topmargin=10 marginwidth=0 marginheight=0>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="150"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><img src="images/menu_top.gif" width=151 height=32></td>
</tr>
<tr>
<td valign="top"><table width="150" height="125" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="4" rowspan="10"><img src="images/menu_left.gif" width="4" height="125"></td>
<td width="142" height="25"><a href="index.php?lol=home"><img src="images/button_01.gif" width=142 height=25 border="0"></a></td>
<td width="4" rowspan="10"><img src="images/menu_right.gif" width="4" height="125"></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=about"><img src="images/button_02.gif" width=142 height=25 border="0"></a></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=gfx"><img src="images/button_03.gif" width=142 height=25 border="0"></a></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=links"><img src="images/button_05.gif" width=142 height=25 border="0"></a></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=contact"><img src="images/button_06.gif" width=142 height=25 border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><img src="images/menu_bottom.gif" width=150 height=83 border="0"></td>
</tr>
</table></td>
<td width="14"><img src="images/spacer.gif" width="10" height="10"></td>
<td width="1232"><table border="0" cellpadding="0" cellspacing="0" class="main-bg">
<tr>
<td valign="top"><table width="604" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="604"><img src="images/port_03.gif" width=604 height=83></td>
</tr>
<tr>
<td><img src="images/port_09.gif" width=604 height=4></td>
</tr>
<tr>
<td><table width="604" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="353"><img src="images/port_10.gif" width=353 height=21></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="160" valign="top"><table width="592" height="260" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="582" height="auto" valign="top" style="color:#a6e082;"><?PHP
if(isset($_GET['lol'])) {
$lol = $_GET['lol'];
} else {
$lol = "home";
}
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("asdada", $con);
$rowsPerPage = 3;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query = " SELECT * FROM ".$lol." " .
"ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
while($row = mysql_fetch_array($result))
{
if($_GET['lol'] == "home") {
echo("<strong>".$row['title']."</strong><br />");
echo("-------------------------------<br />");
echo("".$row['content']."<br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "") {
echo("<strong>".$row['title']."</strong><br />");
echo("-------------------------------<br />");
echo("".$row['content']."<br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "about") {
echo("<strong>".$row['question']."</strong><br />");
echo("-------------------------------<br />");
echo("".$row['answer']."<br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "gfx") {
echo("<strong>".$row['title']."</strong><br />");
echo("-----<br />");
echo("<img src=".$row['image']." border='0' /></a><br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "links") {
echo("<a href='".$row['link']."'><img src=".$row['logo']." border='0' /></a><br />");
echo("-----<br />");
echo($row['desc']."<br />");
echo("-------------------------------<br />");
}
}
$maxPage = ceil($numrows/$rowsPerPage);
$self = $_SERVER['PHP_SELF'];
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"index.php?lol=$lol&page=$page\">[Prev]</a>";
$first = " <a href=\"index.php?lol=$lol&page=1\">[First Page]</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"index.php?lol=$lol&page=$page\">[Next]</a> ";
$last = " <a href=\"index.php?lol=$lol&page=$maxPage\">[Last Page]</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
if($_GET['lol'] == "contact") {
echo("");
} else {
echo ("".$first."".$prev .
" Showing page $pageNum of $maxPage pages " .$next." ".$last."");
echo("<br />");
}
// and close the database connection
mysql_close($con);
if($_GET['lol'] == "contact") {
echo("You can contact me trough:<br />
<strong>Email:</strong> [email protected]<br />
<strong>Msn:</strong> [email protected]<br />
<strong>Otaku-Studios Pm:</strong> Nothing<br />
");
} else if(($lol !== "home") || ($_GET['lol'] !== "about") || ($_GET['lol'] !== "links") || ($_GET['lol'] !== "gfx") || ($_GET['lol'] !== "contact") || ($_GET['lol'] !== "")){
echo("");
}
?></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><img src="images/port_25.gif" width=604 height=25></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<head>
<title>Candan Creations</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/table_background.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor=#FFFFFF leftmargin=0 topmargin=10 marginwidth=0 marginheight=0>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="150"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><img src="images/menu_top.gif" width=151 height=32></td>
</tr>
<tr>
<td valign="top"><table width="150" height="125" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="4" rowspan="10"><img src="images/menu_left.gif" width="4" height="125"></td>
<td width="142" height="25"><a href="index.php?lol=home"><img src="images/button_01.gif" width=142 height=25 border="0"></a></td>
<td width="4" rowspan="10"><img src="images/menu_right.gif" width="4" height="125"></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=about"><img src="images/button_02.gif" width=142 height=25 border="0"></a></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=gfx"><img src="images/button_03.gif" width=142 height=25 border="0"></a></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=links"><img src="images/button_05.gif" width=142 height=25 border="0"></a></td>
</tr>
<tr>
<td height="25"><a href="index.php?lol=contact"><img src="images/button_06.gif" width=142 height=25 border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><img src="images/menu_bottom.gif" width=150 height=83 border="0"></td>
</tr>
</table></td>
<td width="14"><img src="images/spacer.gif" width="10" height="10"></td>
<td width="1232"><table border="0" cellpadding="0" cellspacing="0" class="main-bg">
<tr>
<td valign="top"><table width="604" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="604"><img src="images/port_03.gif" width=604 height=83></td>
</tr>
<tr>
<td><img src="images/port_09.gif" width=604 height=4></td>
</tr>
<tr>
<td><table width="604" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="353"><img src="images/port_10.gif" width=353 height=21></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="160" valign="top"><table width="592" height="260" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="582" height="auto" valign="top" style="color:#a6e082;"><?PHP
if(isset($_GET['lol'])) {
$lol = $_GET['lol'];
} else {
$lol = "home";
}
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("asdada", $con);
$rowsPerPage = 3;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query = " SELECT * FROM ".$lol." " .
"ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
while($row = mysql_fetch_array($result))
{
if($_GET['lol'] == "home") {
echo("<strong>".$row['title']."</strong><br />");
echo("-------------------------------<br />");
echo("".$row['content']."<br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "") {
echo("<strong>".$row['title']."</strong><br />");
echo("-------------------------------<br />");
echo("".$row['content']."<br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "about") {
echo("<strong>".$row['question']."</strong><br />");
echo("-------------------------------<br />");
echo("".$row['answer']."<br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "gfx") {
echo("<strong>".$row['title']."</strong><br />");
echo("-----<br />");
echo("<img src=".$row['image']." border='0' /></a><br />");
echo("-------------------------------<br />");
} else if($_GET['lol'] == "links") {
echo("<a href='".$row['link']."'><img src=".$row['logo']." border='0' /></a><br />");
echo("-----<br />");
echo($row['desc']."<br />");
echo("-------------------------------<br />");
}
}
$maxPage = ceil($numrows/$rowsPerPage);
$self = $_SERVER['PHP_SELF'];
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"index.php?lol=$lol&page=$page\">[Prev]</a>";
$first = " <a href=\"index.php?lol=$lol&page=1\">[First Page]</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"index.php?lol=$lol&page=$page\">[Next]</a> ";
$last = " <a href=\"index.php?lol=$lol&page=$maxPage\">[Last Page]</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
if($_GET['lol'] == "contact") {
echo("");
} else {
echo ("".$first."".$prev .
" Showing page $pageNum of $maxPage pages " .$next." ".$last."");
echo("<br />");
}
// and close the database connection
mysql_close($con);
if($_GET['lol'] == "contact") {
echo("You can contact me trough:<br />
<strong>Email:</strong> [email protected]<br />
<strong>Msn:</strong> [email protected]<br />
<strong>Otaku-Studios Pm:</strong> Nothing<br />
");
} else if(($lol !== "home") || ($_GET['lol'] !== "about") || ($_GET['lol'] !== "links") || ($_GET['lol'] !== "gfx") || ($_GET['lol'] !== "contact") || ($_GET['lol'] !== "")){
echo("");
}
?></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><img src="images/port_25.gif" width=604 height=25></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Hij laat de next button niet zien, ook al zijn er 30 paginas, als je op pagina 1 staat.
Relevante code...?
Code (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
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
<?PHP
$rowsPerPage = 3;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query = " SELECT * FROM ".$lol." " .
"ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
while($row = mysql_fetch_array($result))
{
/* HIER DUS DE DATA VERWERKING */
}
$maxPage = ceil($numrows/$rowsPerPage);
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"index.php?lol=$lol&page=$page\">[Prev]</a>";
$first = " <a href=\"index.php?lol=$lol&page=1\">[First Page]</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"index.php?lol=$lol&page=$page\">[Next]</a> ";
$last = " <a href=\"index.php?lol=$lol&page=$maxPage\">[Last Page]</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
echo ("".$first."".$prev.
" Showing page $pageNum of $maxPage pages " .$next." ".$last."");
?>
$rowsPerPage = 3;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query = " SELECT * FROM ".$lol." " .
"ORDER BY id DESC LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
while($row = mysql_fetch_array($result))
{
/* HIER DUS DE DATA VERWERKING */
}
$maxPage = ceil($numrows/$rowsPerPage);
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"index.php?lol=$lol&page=$page\">[Prev]</a>";
$first = " <a href=\"index.php?lol=$lol&page=1\">[First Page]</a> ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"index.php?lol=$lol&page=$page\">[Next]</a> ";
$last = " <a href=\"index.php?lol=$lol&page=$maxPage\">[Last Page]</a> ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
echo ("".$first."".$prev.
" Showing page $pageNum of $maxPage pages " .$next." ".$last."");
?>
Gewijzigd op 01/01/1970 01:00:00 door Stefan Candan
Iemand?