Pagina nummers werken niet meer help

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

A Jansen

A Jansen

15/03/2009 14:20:00
Quote Anchor link
Probleem mijn pagina nummering werkt niet meer

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php require_once('Connections/Proberen.php'); ?>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php
if (!function_exists("GetSQLValueString")) {
function
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{

  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case
"text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case
"long":
    case
"int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case
"double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case
"date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case
"defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }

  return $theValue;
}
}


$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Flevoland = 25;
$pageNum_Flevoland = 0;
if (isset($_GET['pageNum_Flevoland'])) {
  $pageNum_Flevoland = $_GET['pageNum_Flevoland'];
}

$startRow_Flevoland = $pageNum_Flevoland * $maxRows_Flevoland;

mysql_select_db($database_Proberen, $Proberen);
$query_Flevoland = "SELECT * FROM flevoland ORDER BY Plaats ASC, flevoland.Camping";
$query_limit_Flevoland = sprintf("%s LIMIT %d, %d", $query_Flevoland, $startRow_Flevoland, $maxRows_Flevoland);
$Flevoland = mysql_query($query_limit_Flevoland, $Proberen) or die(mysql_error());
$row_Flevoland = mysql_fetch_assoc($Flevoland);

if (isset($_GET['totalRows_Flevoland'])) {
  $totalRows_Flevoland = $_GET['totalRows_Flevoland'];
}
else {
  $all_Flevoland = mysql_query($query_Flevoland);
  $totalRows_Flevoland = mysql_num_rows($all_Flevoland);
}

$totalPages_Flevoland = ceil($totalRows_Flevoland/$maxRows_Flevoland)-1;

$queryString_Flevoland = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Flevoland") == false &&
        stristr($param, "totalRows_Flevoland") == false) {
      array_push($newParams, $param);
    }
  }

  if (count($newParams) != 0) {
    $queryString_Flevoland = "&" . htmlentities(implode("&", $newParams));
  }
}

$queryString_Flevoland = sprintf("&totalRows_Flevoland=%d%s", $totalRows_Flevoland, $queryString_Flevoland);

function
navigatie($currentpage,$totalpages,$url)
{

    $output         = '';
    $output_num        = '';

    // both = 4 of meer
    if (($currentpage - 4) > 0 && ($currentpage + 4) < $totalpages) {
        for($a = ($currentpage-4);$a <= ($currentpage+4);$a++) {
            if ($a == $currentpage) {
                $output_num     .= ' <b>[' . $a .']</b> ';
            }
else {
                $output_num     .= ' <a href="' . $url . $a . '">' . $a . '</a> ';
            }
        }

        if (($currentpage - 4) == 1) {
            $first     = false;
        }
else {
            $first     = true;
        }

        if (($currentpage + 4) == $totalpages) {
            $last     = false;
        }
else {
            $last     = true;
        }

        
    // left = 4 of meer
    } elseif (($currentpage - 4) > 0) {
        $math         = $totalpages - $currentpage;
        $start_temp    = 9 - $math;
        $start         = $currentpage - $start_temp;
        if ($start < 1) {
            $start      = 1;
        }

        for($a = $start;$a <= $totalpages;$a++) {
            if ($a == $currentpage) {
                $output_num     .= ' <b>[' . $a .']</b> ';
            }
else {
                $output_num     .= ' <a href="' . $url . $a . '">' . $a . '</a> ';
            }
        }

        $last     = false;
        $first     = true;
    // right = 4 of meer
    } elseif (($currentpage + 4) < $totalpages) {
        if ($totalpages > 9) {
            $loop = 9;
        }
else {
            $loop = $totalpages;
        }

        for($a = 1;$a <= $loop;$a++) {
            if ($a == $currentpage) {
                $output_num     .= ' <b>[' . $a .']</b> ';
            }
else {
                $output_num     .= ' <a href="' . $url . $a . '">' . $a . '</a> ';
            }
        }

        $last     = true;
        $first     = false;
    // none = 4 of meer
    } else {
        for($a = 1;$a <= $totalpages;$a++) {
            if ($a == $currentpage) {
                $output_num     .= ' <b>[' . $a .']</b> ';
            }
else {
                $output_num     .= ' <a href="' . $url . $a . '">' . $a . '</a> ';
            }
        }

        $last     = false;
        $first     = false;
    }

    if ($first == true) {
        $output     .= ' <b><a href="' . $url . '1">[eerste]</a></b> ';
    }

    if ($currentpage != 1) {
        $output     .= ' <b><a href="' . $url . ($currentpage-1) .' ">[vorige]</a></b> ';
    }

    $output         .= " &nbsp;&nbsp; " . $output_num . "&nbsp;&nbsp;";
    if ($currentpage != $totalpages) {
        $output      .= ' <b><a href="' . $url . ($currentpage+1) . ' ">[volgende]</a></b> ';
    }

    if ($last == true) {
        $output     .= '<b><a href="' . $url . $totalpages . ' ">[laatste]</a></b> ';
    }

    
        return $output;
}


$itemsperpage         = 25;
$totalrecords         = $totalRows_Flevoland; // dit kan een aantal records zijn uit de database
$totalpages           = ceil($totalrecords/$itemsperpage);
if (!IsSet($_GET['p'])) {
    $currentpage     = 1;
}
else {
    $currentpage     = ceil($_GET['p']);
}

if ($currentpage < 1 || $currentpage > ceil($totalpages)) {
    $output     = 'Helaas, deze pagina bestaat niet.';
}
else {
    $output     = navigatie($currentpage,$totalpages,'?p=');
    $output     .= '<br /><br />Pagina: ' . $currentpage;
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<div align="center">
<table border="1" align="center">
<tr>
<td>Camping</td>
<td>Type</td>
<td>Plaats</td>
<td>Website (Ja/Nee)</td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php do { ?>

<tr>
<td><a href="Camping.php?recordID=
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Flevoland['Nr']; ?>
">
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Flevoland['Camping']; ?>
&nbsp; </a> </td>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Flevoland['Type']; ?>
&nbsp; </td>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Flevoland['Plaats']; ?>
&nbsp; </td>
<td>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php echo $row_Flevoland['Website (Ja/Nee)']; ?>
&nbsp; </td>
</tr>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php } while ($row_Flevoland = mysql_fetch_assoc($Flevoland)); ?>

</table>
<br />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
            echo $output;
        ?>

</div>
</body>
</html>
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
mysql_free_result($Flevoland);
?>
 
PHP hulp

PHP hulp

14/05/2024 04:28:10
 
- SanThe -

- SanThe -

15/03/2009 14:28:00
Quote Anchor link
Dubbelpost
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.