Welcome to WebmasterWorld Guest from 54.145.44.134

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

not able to display multiple images from mysql database

multiple images from mysql database

     

saideep2007

10:55 am on Apr 2, 2009 (gmt 0)

5+ Year Member



hi world,

I'm not able to display multiple images from blob.Why the problem occurs.I can able to display one image. by this code.Any solutions would be gr8.Here is my code.Please help

<?php
include "includes/dbconnection.php";

$result = mysql_query("select image from tbl_images");
while($result_data = mysql_fetch_array($result))
{
header("Content-type: image/jpg") ;
header("Content-type: image/gif") ;

print($result_data['image'])."<br>";
}

?>

barns101

11:06 am on Apr 2, 2009 (gmt 0)

5+ Year Member



You appear to be sending the correct content-type headers for the image, then outputting it. However, you are including text content (the <br>), which should not be there.

If you want to list numerous images you need to write two scripts: one to loop through your images and create the HTML (<img> tags) and another that when called from an <img> tag will generate an image (like the first part of your script).