Re: Showing a Blob field in a browser
| From: | George Nicolae | Date: | Sat, 27 Apr 2002 07:28:22 +0000 |
| Subject: | Re: Showing a Blob field in a browser | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13351@lists.php.net to get a copy of this message | ||
The header() information must be send first before sending any character to
browser. That why you receive this error. Try to move the php code first. If
you want to display only an image remove any html codes.
--
Best regards,
George Nicolae
IT Manager
___________________
PaginiWeb.com - Professional Web Design
www.PaginiWeb.com
"Waldemar Brand Neto" <wbn@softall.com.br> wrote in message
news:009801c1ed79$769fe2a0$0b01a8c0@komptascher.org...
Hi, I am a newbie in PHP and Mysql and i´m trying to show a blob field from
a Mysql database in to a browser. Could anyone help me.
Thanks.
The Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Teste.php</title>
</head>
<BODY BGCOLOR=#3366FF>
<CENTER>
<FORM>
<h1> Kompatscher & Cia Ltda </h1>
<hr>
<?php
$con = mysql_connect(*****************) or die ("Erro ao conectar!");
mysql_select_db("**************", $con) or die ("Erro ao selecionar a
database!");
$comando="SELECT
codigo,nome,material,temperatura,pressao,fluido,descricao,foto FROM cadgrupo
WHERE codigo=10";
$res = mysql_query($comando,$con);
$linha = mysql_fetch_array($res);
echo "<TABLE ALIGN=CENTER>";
echo "<tr>";
echo "<td>";
echo "Foto";
echo "</td>";
echo "<td>";
$i= $linha['foto'] ;
$len=strlen($i);
header("Content-type: image/jpeg");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=temp.jpg");
echo "<input type=image src=temp.jpg border=0>";
echo "</td>";
echo "</tr>";
echo "</TABLE>";
mysql_close($con);
?>
</FORM>
</CENTER>
</BODY>
</html>
The anwser of the browse
Kompatscher & Cia Ltda
----------------------------------------------------------------------------
----
Foto
Warning: Cannot add header information - headers already sent by
(output started at C:\Inetpub\wwwroot\Teste.php:11) in
C:\Inetpub\wwwroot\Teste.php on line 25
Warning: Cannot add header information - headers already sent by
(output started at C:\Inetpub\wwwroot\Teste.php:11) in
C:\Inetpub\wwwroot\Teste.php on line 26
Warning: Cannot add header information - headers already sent by
(output started at C:\Inetpub\wwwroot\Teste.php:11) in
C:\Inetpub\wwwroot\Teste.php on line 27