I an a php novice and I am trying to display thumbnails, .jpeg files, in a table that are store in a file /thumbs. The file names are stored in a MySql table. I have a .php script that displays the files if there is only one item in the table. However, once there is more 1 record in the table the same file is displayed no matter what the name of the file is. The code below is image.php. This is the code that displays the thumbnail. Below is the script the builds the table.<?php session_start(); $imagepath = $_SESSION['Thumbnail']; $image=imagecreatefromjpeg($imagepath); header('Content-Type: image/jpeg'); imagejpeg($image); unset($_SESSION['Thumbnail']); ?>
The name of the file is in the session variable $_SESSION[‘Thumbnail’].
The code that accesses this file is below. The name of the image file is retrieved from the data base and stored in the session variable $_SESSION[‘Thumbnail’]. Each time throught the while loop. If I run this code I get a table with the Image name, stored in $_SESSION[‘Thumbnail’], displayed but the image is always the same. What ame I doing wrong?<?php session_start(); include("functions_main.inc"); include("Overpar.inc"); $Images = items_forsale("Overpar.inc"); ?>