Ich zeige Fotos aus der Datenbank.Paginierung zeigen Inhalt nicht von Isset-Methode
<div class="col-md-10 bg col-md-push-2 ">
<div class="align_center gallery">
<?php
if(isset($_POST['submit'])){
include "anj.php";
$sql = 'SELECT * FROM new_photos WHERE weight BETWEEN 10 AND 15';
// function anjaan has code for showing images
anjaan($sql);
}else{
include "anj.php";
$sql='select * from new_photos';
anjaan($sql);
}
?>
</div>
<div class=" align_center ">
<div class=" col-md-12 pagination gallery">
<?php
echo $paginationctrl;
?>
</div>
</div>
</div>
ich verwende post-Methode
<form method="post" action="index.php">
<input type="Submit" name="submit" value="submit">
</form>
i auf die Schaltfläche klicken Sie auf Absenden dann zeigt es Bilder aus der ersten Abfrage ("SELECT * FROM new_photos WHERE Gewicht zwischen 10 und 15"), aber wenn ich Klicken Sie auf Seite 2 von Seitenumbruch laden Sie Inhalt von sonst (zweite Abfrage "SELECT * FROM new_phoos") -Methode.
Paginierung-Code mein anj.php
<?php
function anjaan($sql){
include 'database.php';
function make_thumb($src, $dest, $desired_width) {
/* read the source image */
$source_image = imagecreatefromjpeg($src);
$width = imagesx($source_image);
$height = imagesy($source_image);
/* find the "desired height" of this thumbnail, relative to the desired
width */
$desired_height = floor($height * ($desired_width/$width));
/* create a new, "virtual" image */
$virtual_image = imagecreatetruecolor($desired_width, $desired_height);
/* copy source image at a resized size */
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0,
$desired_width, $desired_height, $width, $height);
/* create the physical thumbnail image to its destination */
imagejpeg($virtual_image, $dest);
}
$sql ;
$query = mysqli_query($db,"$sql");
$row = mysqli_num_rows($query);
$rows =$row[0];
$page_rows=8;
$last=ceil($row/$page_rows);
if($last<1){
$last= 1;
}
$pagenum=1;
if(isset($_GET['pn'])){
$pagenum = (int) $_GET['pn'];
}
if($pagenum<1){
$pagenum=1;
}
else if($pagenum>$last){
$pagenum=$last;
}
$limit='LIMIT' .($pagenum-1) * $page_rows.','.$page_rows;
$n=($pagenum-1) * $page_rows;
$sql1 = " $sql LIMIT $n ,$page_rows";
$query = mysqli_query($db,$sql1);
global $paginationctrl;
$paginationctrl='';
if($last !=1){
if($pagenum>1){
$previous = $pagenum-1;
$paginationctrl .='<a href="'.$_SERVER['PHP_SELF'].'?
pn='.$previous.'">Pr</a>'.' ';
for($i = $pagenum-3 ;$i<$pagenum;$i++){
if($i>0){
$paginationctrl .='<a class="active"
href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a>'.' ';
}
}
}
$paginationctrl .=''.$pagenum.' ' ;
for($i = $pagenum+1 ;$i<$last;$i++){
$paginationctrl .='<a class="active"
href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'">'.$i.'</a>'.' ';
if($i>=$pagenum+4){
break;
}
}
if($pagenum != $last){
$next =$pagenum+1;
$paginationctrl .=' <a href="'.$_SERVER['PHP_SELF'].'?pn='.$next.'">Next</a>';
}
}
while($row = mysqli_fetch_array($query,MYSQLI_ASSOC)){
$r=$row['path'];
$id=$row['weight'];
$image = "new_photos/".$row['path'];
$image1 = "images/thumb/".$row['path'];
$path = 'images/thumb/'.$r;
$thumb = make_thumb($image, $path,1000);
?>
<a class="fancybox col-md-6" href="<?php echo $image; ?>" data-
fancybox="image" >
<img class = " galleryimage" src= "<?php echo $image1; ?>" >
<p class=" align_center"><?php echo $id; ?> gm</p>
</a>
<?php }}
?>
Wollen Sie bitte geben Sie Ihren Code für Paginierung? –
jetzt überprüfen Sie es .. –