Jump to content

php header


simple_man_11

Recommended Posts

when using the below code I get the following error:

The image “SecondType.php3” cannot be displayed, because it contains errors.

 

 

<?

include('config.php');


$query="SELECT * FROM Images where userID = '$userID' ";
$result=mysql_query($query);

while ($array= mysql_fetch_assoc($result)) 
	{

		Header( "Content-type: image/gif");
                echo "$user $array[image]";
	}

	if (!$result)
	{
	echo "Did not retreive anything from the database";
	}
?> 

 

I realize the problem is the line:

  echo "$user $array[image]";

 

where if I take out $user then it will display the image just fine.  I need it to display an image and some text.  I have a feeling that I need to use a different Header() function but am having no luck finding anything for mixed.  Maybe this can not be done???

 

--------------------------------------------------------

if I do it like the following code then I get another error:

user: chad

Warning: Cannot modify header information - headers already sent by (output started at  SecondType.php3:2) in  SecondType.php3 on line 12

 

ÿØÿà�JFIF�,,��ÿí LPhotoshop 3.0�8BIMí Resolution����,����,����8BIM FX Global Lighting Angle�������x8BIMFX Global Altitude�������8BIMóPrint Flags��� ���������8BIM Copyright Flag������8BIM'Japanese .... (more gerberish)....

 

<?
echo "$user";
include('config.php');


$query="SELECT * FROM Images where userID = '$userID' ";
$result=mysql_query($query);

while ($array= mysql_fetch_assoc($result)) 
	{

		Header( "Content-type: image/gif");
		echo "$array[image]";
	}

	if (!$result)
	{
	echo "Did not retreive anything from the database";
	}



?> 

 

 

Link to comment
https://forums.phpfreaks.com/topic/53654-php-header/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.