Try doing echo stripslashes($data);

Or try setting the content type to text/plain - This should echo back
gobblygook (Just so you know that there IS image data there.

Also.. you have <img src=\"petdata.php?id=$id\"> in another file right? If
you call petdata.php by itself, you should see just the image.


-----Original Message-----
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 4:41 PM
Subject: [PHP-DB] I'm really stuck!

Hi all,

I'm really stuck and I'm not asking anyone to re-write this just show me
what is wrong, or explain why it wont work. It just seems logical that this
should work.

The first query will print the pet id in the browser.

$query="SELECT  id FROM wt_users WHERE uid={$session["uid"]}";
$ret = mysql_query($query);
print("<BR>your pet id is $pet");

So if $pet will print the id from the wt_users (has a value of 3) and I
assign $id = $pet (id also has a value of 3 in image_data)  why doesn't it
show the image?

if($id) {

$id = $pet;
    $query = "select bin_data,filetype from image_data where id=$id";

  $result = mysql_query($query);

    $data = mysql_query($result,0,"bin_data");
    $type = mysql_query($result,0,"filetype");

    Header( "Content-type: $type");
    echo $data;

echo "<img src=\"petdata.php?id=$id\">";

Jennifer Downey

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to