Hi Leuts
ich habe ein "Blattersystem" welches immer nur 15 einträge einer DB anzeigen soll. Hier der Code:
Jedoch habe ich ein Problem: Die Ausgaben aus den Funktionen sind immer leer. Weshalb? Ich kann es mir nicht erklären. Wo liegt mein Fehler? Ausserdem, auch wenn ich an die URL ?page=n anhänge führt er denoch immer die !isset($_POST['page']) aus, ebenfalls weshalb? Ich bin echt ratlos und bitte um Hilfe.
LG
Garnele
ich habe ein "Blattersystem" welches immer nur 15 einträge einer DB anzeigen soll. Hier der Code:
PHP-Code:
<?php
/* Starte Seiten Management */
function nextt ($min, $max)
{
$new_max = $max +15;
$new_min = $min +15;
$ar = array();
$ar['min'] = $new_min;
$ar['max'] = $new_max;
return $ar;
}
function backk ($min, $max)
{
if ($min == 0 and $max == 15)
{
$new_min = 0;
$new_max = 15;
}
else
{
$new_min = $min -15;
$new_max = $max -15;
}
$ar2 = array();
$ar2['min'] = $new_min;
$ar2['max'] = $new_max;
return $ar2;
}
function make_limitt ($min, $max)
{
$limit = "LIMIT $min,$max";
echo $limit;
return $limit;
}
if ($_POST['page'] == "n")
{
nextt ($_SESSION['next_min'], $_SESSION['next_max']);
backk ($_SESSION['next_min'], $_SESSION['next_max']);
make_limitt ($_SESSION['next_min'], $_SESSION['next_max']);
$lim = $limit;
$_SESSION['next_min'] = $ar['min'];
$_SESSION['next_max'] = $ar['max'];
$_SESSION['back_min'] = $ar2['min'];
$_SESSION['back_max'] = $ar2['max'];
}
else if ($_POST['page'] == "b")
{
nextt ($_SESSION['back_min'], $_SESSION['back_max']);
backk ($_SESSION['back_min'], $_SESSION['back_max']);
make_limitt ($_SESSION['next_min'], $_SESSION['next_max']);
$lim = $limit;
$_SESSION['next_min'] = $ar['min'];
$_SESSION['next_max'] = $ar['max'];
$_SESSION['back_min'] = $ar2['min'];
$_SESSION['back_max'] = $ar2['max'];
}
else if (!isset($_POST['page']))
{
nextt (0, 15);
backk (0, 15);
make_limitt (0, 15);
$lim = $limit;
$_SESSION['next_min'] = $ar['min'];
$_SESSION['next_max'] = $ar['max'];
$_SESSION['back_min'] = $ar2['min'];
$_SESSION['back_max'] = $ar2['max'];
}
/* Fertig seiten Management */
?>
LG
Garnele
Kommentar