0

how can i make next page and prev page in my gallery script ..
when
mid = id of images
path = link of images
i need 2 button next to get next image and prev to get last image ?? how can i do it ?

$mid=$_GET['mid'];
$qur="select * from images where mid='$mid'";
$res=mysql_query($qur,$conn);
?>
<?php while($row=mysql_fetch_array($res)){ ?>

<div class="gallery-img">
<a href="admin/<?php echo $row['path'] ?>" rel="prettyPhoto" class="portfolio-img" title="<?php echo $row['image_title'] ?>">
<img src="admin/<?php echo $row['path'] ?>" alt="<?php echo $row['image_title'] ?>" width="100%" height="100%" />
</a>
</div>  

<?php } ?>
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
1
  1. get the total number of pics from the db/search. I assume mid related to member_id as opposed to individual photo_id.
  2. Assuming that you're displaying one image at a time, you can use an 'almost pure' js, an ajax or a pure php solution.

The js version will load all image urls into an array, so that button movement will just change the url of the image src attribute. No page refresh required.
The php version will load the image based on the button (form) submission. Page refresh will happen.
The ajax version can be simple or complicated, but will be similar to the php version, you just hijack the button click to prevent form submission. This has the 'dubious' advantage over the js-only version of being up-to-date-ish. That is if it checks the server for the new image, it can also get the latest number of images, so if an user adds a photo while you're perusing, it should be updated. No page refresh. The downside is that you once again involve the server.

So, what sort of solution are you looking for?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.