homepage Welcome to WebmasterWorld Guest from 54.166.84.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
not able to display multiple images from mysql database
multiple images from mysql database
saideep2007

5+ Year Member



 
Msg#: 3883814 posted 10:55 am on Apr 2, 2009 (gmt 0)

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

5+ Year Member



 
Msg#: 3883814 posted 11:06 am on Apr 2, 2009 (gmt 0)

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).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved