I've been trying to get help with this problem for a few hours now. I'm going to explain as thoroughly as I can.
On the site i'm building, I allow my users to upload photos. When they upload a photo the photo is uploaded to my server and the path is saved in my database.
The user has a control panel page where they can edit information, including the photos they have uploaded.
I displayed all of the users photos in their control panel, using a while loop
$img_url = "http://localhost/mw/photos/";
$result = mysql_query("SELECT photo FROM photos WHERE id= '$_SESSION[id]' ");
while($row = mysql_fetch_assoc($result)){
echo '<a href="photoedit.php"><img src="'.$img_url.$row['photo'].'" /></a>';
}
This code successful displays all the users photos as thumbnails. The second step is what i'm having trouble with. When the user clicks the photo I want to link to the photoedit.php page and display the fullsize image of the photo that they clicked up.
Initially I tried this and it worked... but not the way I intended
$img_url = "http://localhost/mw/photos/";
$result = mysql_query("SELECT photo FROM photos WHERE id= '$_SESSION[id]' ");
while($row = mysql_fetch_assoc($result)){
$_SESSION['photo'] = $row['photo'];
echo '<a href="photoedit.php"><img src="'.$img_url.$_SESSION['photo'].'" /></a>';
}
on the photoedit page I started the session and echoed the photo as such
<?php echo '<img src="'.$img_url.$_SESSION['photo'].'" />'; ?>
So I clicked one of the photos and it displayed correctly, I went back and clicked a different thumbnail and it displayed the same picture from the first thumbnail I clicked.
I've literally been racking my brain for hours and I've been looking for help everywhere and I can't figure out what I am doing wrong.. I imagine it's something simple- because that's what most of my problems are.
I have a hunch the problem is related to the session
any help would be much appreciated, I want to rip my hair out, lol
Thanks
SweetG