I'm trying to retrieve and output all the binary images in my images table.
This is what I have,

$result = mysql_query("SELECT * FROM images",$db);

    if ($myrow = mysql_fetch_array($result)) {

      // display list if there are records to display

      do {
       $filetype = ($myrow["filetype"]);
       header("Content-type: $filetype");
       echo $myrow["binary_junk"]."<br>\n";

      } while ($myrow = mysql_fetch_array($result));

    } else {

      // no records to display

      echo "Sorry, no records were found!";

When I run this, it only returns the first image in the table. Have really
know idea where to go from here.  Is one image all that can be done?

Ok.. some information for you, as you seem to mis-understand some things

A web-browser can handle certain pices of information being thrown down it's
gullett..  The Content-type: is what determines this.

If you start by throwing it an image/gif, then it will expenct a gif to come
down.  If you start throwing "<BR>"'s down, it will not only corrupt the
image, but not do anything remotely related to HTML.

Basically what you need to do is to set up a second PHP routine which grabs
the binary data from the dataqbase and displays it, using <IMG> tags.

The first routine just sets up the <IMG tags pointing to the second..

I've got an example of the code required to do something like this if you
want to take a look..   (http://elfgrove.virtual.net.au/~bekar/test.phps)

hope this helps.


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to