Forum Moderators: coopster

Message Too Old, No Replies

Blob does not display multiple images from mysql database

         

nil111

4:48 am on Jul 29, 2008 (gmt 0)

10+ Year Member



<?php
//header('Content-Type: image/jpeg');
header('Content-Type: text/html');
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
$result = mysql_query("SELECT * FROM paintings");
while($row = mysql_fetch_assoc($result)){
print $row[p_painting_id]."</br>";
//print $row[p_painting_image];
}
?>

this code displays all the painting ids available in the table 'gallery'.

but the below coding doesnt display all the corresponding images(of blob type).
Please tell em why.thanks in advance!

<?php
header('Content-Type: image/jpeg');
//header('Content-Type: text/html');
@mysql_connect("localhost","root","dba") or die("Error");
@mysql_select_db("gallery");
$result = mysql_query("SELECT * FROM paintings");
while($row = mysql_fetch_assoc($result)){
//print $row[p_painting_id]."</br>";
print $row[p_painting_image];
}
?>

d40sithui

3:17 pm on Jul 29, 2008 (gmt 0)

10+ Year Member



the only thing i can think of right now is your field in the db is empty. have you checked to make sure that p_painting_image contains text?

jatar_k

3:56 pm on Jul 29, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try getting it to work for a single image

I don't think it will work that way for multiple images, off the top of my head, but it may for a single one

this thread may hold some answers
How to convert image blob files back to image [webmasterworld.com]