Click to See Complete Forum and Search --> : Image Display


kproc
08-16-2006, 06:11 PM
Hi.

I have been able to sucessfully load images to a database. I can get this to display on the page. For some reason it the code below will not loop through and display the individual pitchers. If there are three pitchers in the table it will display the three pitchers but not the correct images. it repeats the first image that matches the search.

something interesting is when i rest my mouse over the image to see the path if I where to click on it, it shows the correct file name but not the correct image.

Thank you for any help :)


Displaying the image

<HTML>
<BODY>
<?

include 'db.php';


$result=mysql_query("SELECT * FROM upload") or die("Can't Perform Query");
While($row=mysql_fetch_object($result)) {

echo "<A HREF =\"secondType.php?name=$row->name\"> <IMG SRC=\"secondType.php?name=$row->name\" width=100 Height=125></a>";
}
?>
</BODY>
</HTML>



SecondType.php script


<?


<?


include 'db.php';

/*$name = $_REQUEST['name'];
echo $name;*/


$result=mysql_query("SELECT * FROM upload WHERE name=$name") or die("Can't perform Query");
$row=mysql_fetch_object($result);
Header( "Content-type: image/jpeg");
echo $row->content;

?>

kproc
08-16-2006, 08:01 PM
based on the above code no image is displayed. If I change the $name variable to a file name it opens the file three time. when I rest cursor over it the file name appears correct in path.

kproc
08-16-2006, 09:46 PM
I figured out my problem but ran into another snag

I want to add some information at the bottom of the image but for some reason my code soots the text to the right

any thouhght why


$result = mysql_query("SELECT * FROM images") or die("Can't Perform Query");

while ($row=mysql_fetch_object($result)){;

echo "<A HREF =\"getImage.php?Photo_id=$row->Photo_id\"> <IMG SRC=\"getImage.php?Photo_id=$row->Photo_id\" width=100 Height=100></a>";
echo $row ->name;
}
?>