bezorg de laatste berichten direct op de desktop
Welkom, Gast
Alstublieft Inloggen of Registreren.    Wachtwoord verloren?

Pagina nummers werken niet meer
(1 bezoeker) (1) Gast
Ga naar onderkantPagina: 1
TOPIC: Pagina nummers werken niet meer
#6190
Pagina nummers werken niet meer 2 Jaren, 11 Maanden geleden Karma: 0
Probleem mijn pagina nummering werkt niet meer

<?php require_once('Connections/Proberen.php'); ?>
<?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 .= "    " . $output_num . "  ";
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" "www.w3.org/TR/xhtml1/DTD/xhtml1-transiti...td">
<html xmlns="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>
<?php do { ?>
<tr>
<td><a href="Camping.php?recordID=<?php echo $row_Flevoland['Nr']; ?>"> <?php echo $row_Flevoland['Camping']; ?>  </a> </td>
<td><?php echo $row_Flevoland['Type']; ?>  </td>
<td><?php echo $row_Flevoland['Plaats']; ?>  </td>
<td><?php echo $row_Flevoland['Website (Ja/Nee)']; ?>  </td>
</tr>
<?php } while ($row_Flevoland = mysql_fetch_assoc($Flevoland)); ?>
</table>
<br />
<?php
echo $output;
?>
</div>
</body>
</html>
<?php
mysql_free_result($Flevoland);
?>
AJansen
Newbie
Berichten: 4
graphgraph
Gebruiker offline Klik hier om het gebruikersprofiel van deze gebruiker te zien
De Administrator heeft publieke schrijf toegang geblokkeerd.
 
#6191
Re:Pagina nummers werken niet meer 2 Jaren, 11 Maanden geleden Karma: 0
Probleem mijn pagina nummering werkt niet meer.

Het doet niets als ik op de cijfers 1 2 3 klik.
Heb in mijn database 59 records staan ik wil per keer 25 weer geven, als ik nu op een pagina nummer (Bijv. 2 of 3) klik blijf ik alleen de eerste 25 zien. Je moet dan 26 tot 50 zien.

Ik hoop dat iemand mij hier mee kan helpen

Code:


<?php require_once('Connections/Proberen.php'); ?>
<?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  .= "    " . $output_num . "  ";
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>
    <?php do { ?>
      <tr>
        <td><a href="Camping.php?recordID=<?php echo $row_Flevoland['Nr']; ?>"> <?php echo $row_Flevoland['Camping']; ?>  </a> </td>
        <td><?php echo $row_Flevoland['Type']; ?>  </td>
        <td><?php echo $row_Flevoland['Plaats']; ?>  </td>
        <td><?php echo $row_Flevoland['Website (Ja/Nee)']; ?>  </td>
      </tr>
      <?php } while ($row_Flevoland = mysql_fetch_assoc($Flevoland)); ?>
  </table>
  <br />
  <?php
echo $output;
        ?>
</div>
</body>
</html>
<?php
mysql_free_result($Flevoland);
?>

AJansen
Newbie
Berichten: 4
graphgraph
Gebruiker offline Klik hier om het gebruikersprofiel van deze gebruiker te zien
De Administrator heeft publieke schrijf toegang geblokkeerd.
 
#6192
Re:Pagina nummers werken niet meer 2 Jaren, 10 Maanden geleden Karma: 0
Heb je toevallig ook een bestand waar wel een Indent en dergelijke inzit, want dit is niet heel erg lekker te lezen zeg maar
_arno_
WMS Fan
Berichten: 16
graphgraph
Gebruiker offline Klik hier om het gebruikersprofiel van deze gebruiker te zien
De Administrator heeft publieke schrijf toegang geblokkeerd.
 
Ga naar bovenkantPagina: 1
Moderators: Rik, Roy