I wrote a script where users in my web can create albums and upload some photos in their album.
I need someone to explain to me what i should do to enable members after they open a certain album,and see photos which are
four in a row.
And then if he/she Clicks a photo to be opened in a new page and to be Given a link(Next,previous) for others photos of the album.

i tried some and ended in Displaying only a photo which is being clicked and unable to put the NEXT or Previous link for Other photos of the album.
below is what i tired to do .
i need to put link for other photos of album lets say "CARS".

<?php
  
  include"config.php";
  
  $user=$_SESSION['user'];
  if(isset($_GET['id'])){
  $photoid=$_GET['id'];
$query = "SELECT  *FROM album_photo WHERE (id='$photoid' and user='$user') ";
$result = mysql_query($query, $dbcnx); 
$row=mysql_fetch_array($result);
$userid=$row['id'];
 $photo=$row['photo'];

echo"<img src=album/$photo  width=120 height=155 border=0 >";
  
}

?>

I dont really understand what you want.
What you wrote above looks fine.

Do you mean you want an aditional peice of code in which displays a next and previous link to other photos in the album?

The only way i think to do this would be to rename the images on upload.
Making them numeric would give them an order,

so for example you could write:

<?php
$photo=$row;

echo"<img src=album/$photo width=120 height=155 border=0 >";

$next = $photo + 1;
$previous = $photo - 1;

echo"<a href=album/$next>Next</a><br>";
echo"<a href=album/$previous>Next</a>";

?>

(sorry i'm on edit and therefore can't use code tags)

the issue is like this,i have two tables.
The first table i save only the album names and users who created.
the second one i save the uploaded photo name,username and the album to which it was uploaded.
so when the user login he can see the albums he created and the photos inside.
So from here is is where i explained above.

your code does not specify which album.
if i undestand well.

Ok

The way you've done it is quite complex where it doesnt need to be.
You should have one table and it should hold the name of the file uploaded, the parent album to which it was uploaded, the username of the uploader, and an id (primary key, AI).

When the user logs in you should create a session holding their username. This can then be added to a query to collect all the photo names to which this user has uploaded them.
After this you can filter out all the different albums by either using different sql querys or in PHP.

Once all that is done you can then easily add a next and previous button by doing what i suggested above. Because the query would have sorted out all the files so you have the ones only from the single album.

If that makes any sense I would seriously reconsider coding it in the method above. It's much simpler and also helps for when you need to edit certain peices of code.

Sorry for my bad english, i'm french

If you need any more help
try posting up your code, it would be easier for me to understand.

thankx))i`m working with your idea then i`ll tell if i succeeded.

Ok, just send me a private email if you need any help.
I'm happy to lend a hand

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.