RE: RE: Display picture from MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How about, if we need several pictures from several record?


-----Original Message-----
From: replies-lists-php@xxxxxxxxxxxxxxxxxxxxx
[mailto:replies-lists-php@xxxxxxxxxxxxxxxxxxxxx]
Sent: Thursday, July 07, 2005 8:19 PM
To: Bagus Nugroho
Subject: Re:  RE: Display picture from MySQL


you're trying to set your content-type header every time you loop
through your result set -- so if you have more than one result you'll
try to set your headers multiple times. you can't do that -- that's
what's causing the "cannot modify header information" message.

you need to change your code so that you only send the headers once.
e.g., test that you have items in your result set, if so, set the
content-type header (for image/gif), otherwise don't (so that you can
send a text message).



------------ Original Message ------------
> Date: Thursday, July 07, 2005 08:09:38 PM +0700
> From: Bagus Nugroho <bnugroho@xxxxxxxxxxxx>
> To: php-general@xxxxxxxxxxxxx
> Subject:  RE: Display picture from MySQL
> 
> Hi,
> Firstly, thanks for your advise.
> But, it doesn't work if combine with text or if we need display more
> than one record. Here's my code :
>  
> <?php
>     mysql_connect("localhost","root","password") or Die ("Failed to
> connect");     mysql_select_db("intdata") or Die ("Failed to select
> databse");     $res=mysql_query("SELECT * FROM main") or die("error
> again");
> 
>    while ($line = mysql_fetch_array($res)){
>     echo "Lot Info : $line[lotID]";
>     /*Send headers*/
>     header("content-type: image/gif");
>     echo $line[picture];
>     echo "\n";
>    }
> ?>
>  
> It was displayed several record from $line[lotID], the followed
> information like this : Cannot modify header information - headers
> already sent by 
> and a picture if opened with notepad.
>  
> What's wrong
>  
> Agian, thanks in advance
> 
>  

---------- End Original Message ----------

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux