view all images in one page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sawalif
Forum Newbie
Posts: 2
Joined: Sat Mar 15, 2008 10:24 am

view all images in one page

Post by sawalif »

Hi,
I need help in this code ,,,
I have table named subject ,in this table i have four fields
(id int(9) auto_increment PK, ImageTitle varchar(30), ImageSubject TEXT and Image mediumblob)
I want display all fields in one webpage to show me the Title ,Subject and the image!
In this code i can't run the webpage with the image! it's running without Image when i remove //echo $result2['Image'];

Thank you

Code: Select all

 
 
//view all subjects with the images.
<?php
include ("condb.php");
 
 
$query="select * from subject ";
$result=@mysql_query($query,$con);
 
$result = mysql_query($query) or die('Error, query failed');
 
while ($result2 = mysql_fetch_array($result))
{
echo $result2['ImageTitle'];
echo"<br/>" ;
echo $result2['ImageSubject'];
echo"<br/>" 
header("Content-type: image/jpeg");
echo $result2['Image'];
echo"<hr/>" ;
 
}
 mysql_close();
?>
 
 
sawalif
Forum Newbie
Posts: 2
Joined: Sat Mar 15, 2008 10:24 am

Re: view all images in one page

Post by sawalif »

No any one help me !!!
scriptah
Forum Commoner
Posts: 27
Joined: Sat Mar 15, 2008 8:58 pm
Location: Long Island, NY

Re: view all images in one page

Post by scriptah »

Hello,

You can't "just" send a header after some output have been sent already to the client.
Checkout the php manual explaining the header function.
Post Reply