RE: [PHP-DB] storing images in database

2005-01-26 Thread Chip Wiegand
Thanks for all the tips guys. I'll keep the last couple for future reference. -- Chip Gareth Heyes <[EMAIL PROTECTED]> wrote on 01/26/2005 05:30:45 AM: > >> if(isset($_GET['id'])) { > >> $id=$_GET['id']; > >> $query = "select bin_data, filetype from binary_data where id=$id"; > > This is a

RE: [PHP-DB] storing images in database

2005-01-26 Thread Bastien Koert
TECTED] Subject: RE: [PHP-DB] storing images in database Date: Wed, 26 Jan 2005 13:30:45 + >> if(isset($_GET['id'])) { >> $id=$_GET['id']; >> $query = "select bin_data, filetype from binary_data where id=$id"; This is a really bad example, anyb

RE: [PHP-DB] storing images in database

2005-01-26 Thread Gareth Heyes
>> if(isset($_GET['id'])) { >> $id=$_GET['id']; >> $query = "select bin_data, filetype from binary_data where id=$id"; This is a really bad example, anybody can inject your query with malicious sql commands. Never trust user supplied data. -- PHP Database Mailing List (http://www.php.net/) To u

RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
27;description']; echo ""; echo "\n"; }; ?> And I used table structure CREATE TABLE binary_data ( id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY, description CHAR(50), bin_data LONGBLOB, filename CHAR(50), filesize CHAR(50), filetype CHAR(50) ); hth bastien From: Chip Wieg

RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
Filesystem is easier, by far since it avoids the content header. Glad you solved it bastien From: Chip Wiegand <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: "PHP DB" Subject: RE: [PHP-DB] storing images in database Date: Tue, 25 Jan 2005 14:32:11 -0800 I have done it an easier w

RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
. > > Bastien > > > > > >From: Chip Wiegand <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >CC: "PHP DB" > >Subject: RE: [PHP-DB] storing images in database > >Date: Tue, 25 Jan 2005 12:57:40 -0800 > > > >"Bastien Ko

Re: [PHP-DB] storing images in database

2005-01-25 Thread Martin Norland
Bastien Koert wrote: Its not src='id=$id'> that will defnintely blow up echo ''; where $id is the id of the record you are trying to get the image to... Bastien From: Chip Wiegand <[EMAIL PROTECTED]> [snip] In testing this I have added the code samples to a page and have it working except the p

RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
FWIW, I have the image stored in the database in a blob field, is that correct? -- Chip > >From: Chip Wiegand <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: RE: [PHP-DB] storing images in database > >Date: Tue, 25 Jan 2005 12:44:44 -0800 > > > >

RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
ot; Subject: RE: [PHP-DB] storing images in database Date: Tue, 25 Jan 2005 12:57:40 -0800 "Bastien Koert" <[EMAIL PROTECTED]> wrote on 01/25/2005 12:46:12 PM: > yes goes back to the whole header problem which is why you are here. > > If you could post the code, it would be s

RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
Its not src='id=$id'> that will defnintely blow up echo ''; where $id is the id of the record you are trying to get the image to... Bastien From: Chip Wiegand <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] storing images

RE: [PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
t;); > > @mysql_select_db("binary_data"); > > $query = "select bin_data,filetype from binary_data where id=$id"; > $result = @MYSQL_QUERY($query); > > $data = @MYSQL_RESULT($result,0,"bin_data"); > $type = @MYSQL_RESULT($result,0,"filetype&quo

RE: [PHP-DB] storing images in database

2005-01-25 Thread Bastien Koert
etype from binary_data where id=$id"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0,"bin_data"); $type = @MYSQL_RESULT($result,0,"filetype"); Header( "Content-type: $type"); echo $data; }; ?> bastien From: Chip Wiegand <[EMAIL PROTECTED]> To: "

Re: [PHP-DB] storing images in database

2005-01-25 Thread Micah Stevens
Could be lots of things, improper/missing headers is most likely, although it's not clear from your statement if you're displaying the binary data directly in the page or are you calling an image output script in an image tag. (as you should) Show some code and the answer will be clear. -Mic

[PHP-DB] storing images in database

2005-01-25 Thread Chip Wiegand
I have stored a .jpg image in a database, then when I make a sql statement to display that image on a web page all I get is the cryptic code in place of the image. I am storing it in a row configured as a blob, mime type image/jpeg and binary (using phpMyAdmin). What am I doing wrong? Regards,