Forum Moderators: coopster

Message Too Old, No Replies

Photos pagination

How to do a multiuser pagination

         

romzinho2k7

9:24 pm on Jun 16, 2006 (gmt 0)

10+ Year Member



Good night friends, all right?

Already some weather am developing a site by cars... When I am almost finishing, me a problem appears...

I have a table car_photos. In this table are some ítens, as id, id_user, photo, description...

id_user is because is a system where the advertisers are going to can post photos of his cars for sale. As each user is going to can put 9 photos(not necessarily in sequence), wanted to do the pagination of these photos. The 9 photos usually appear, but when it clicks in one to enlarge, to visualize other photo, has to come back to previous page, and I wanted to do for pagination for not you that always come back to pages previous. And put << Previous Next >> in the photos...

The database is thus +/-:

ID ¦ id_user...
1 ¦ 10...
2 ¦ 11...
3 ¦ 10...

In other words, the user of id 10 is with in the id 1 and 3 of the photos table. I did this way:

--------------------------------
<?php
$query = mysql_query("SELECT * FROM car_photos WHERE id_user='$id_user' ORDER by id DESC LIMIT 1") or die(mysql_error());
$fetch = mysql_fetch_array($query);
$prev = $fetch["id"] - 1;
$url = "index.php?id_car=$prev";
echo "<a href=\"$url\">&laquo; Previous</a>";
?>
-------------------------------------

Kind, when I put in the photo(iD) 3, instead of his go to the photo(iD) 1, that is to other photo that Pertence to the user, he goes to the photo(iD) 2, but this is not the iD of the user, and then he jumps where does not have anything exist with that the user was sell...

Kind, we will suppose that the current photo be 200 and that the previous photo of this user be 190, would not have how to put the link for the ID of the previous photo (in the case 190), so that it stayed "index.php?id_car=PHOTO(in the case 190)"?

I think it would be better, because for URL would go to be smaller...

Please help me

Sorry my english. I am learning

Thanks.

AndreJul

6:07 am on Jun 17, 2006 (gmt 0)

10+ Year Member



I don't quite understand your point, do you want to make so that the page consist of a picture and previous and next button? and the image changes as you press next or prev?