468,758 Members | 2,055 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,758 developers. It's quick & easy.

How to read blob data from database

i have inserted blob data in database , but i am not able to access back that data to the browser. i have php script but it does not work proprly.
our script is below
Expand|Select|Wrap|Line Numbers
  1. if ($_REQUEST[gim] == 1) {
  2.     header("Content-type: image/jpeg");
  3.     print $bytes;
  4.     exit ();
  5. }
  6.  
but it does not work correctly.
the Question is now that how i will read blob data to the browser
Thanksss
Nov 12 '07 #1
1 6548
ak1dnar
1,584 Expert 1GB
Only thing you need to set up the correct header.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $con = mysql_connect('localhost', 'root', 'dba') or die ("Could not connect to the Database");
  3. mysql_select_db('mytable', $con) or die (mysql_error()); 
  4. $query = 'SELECT content FROM blobdata';
  5. $result = mysql_query($query);
  6. while ($row = mysql_fetch_array($result)){
  7. header("Content-type: image/jpeg");
  8. echo $row['content'];
  9. }
  10. ?>
Nov 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Thierry | last post: by
7 posts views Thread by John | last post: by
4 posts views Thread by Ellen K | last post: by
3 posts views Thread by hamvil79 | last post: by
2 posts views Thread by Luis Mendes | last post: by
3 posts views Thread by =?Utf-8?B?ZGF2aWQ=?= | last post: by
4 posts views Thread by =?ISO-8859-1?Q?Hans_M=FCller?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.