Irish SEO,  Marketing & Webmaster Discussion

 

mySQL BLOB Problem

This is a discussion on mySQL BLOB Problem within the Coding Help forums, part of the Webmaster Help category; I am retrieving a blob from the DB and trying to display it on a page as an image. The ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 17-11-2007, 05:08 AM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 410
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default mySQL BLOB Problem

I am retrieving a blob from the DB and trying to display it on a page as an image. The problem is i just get the image reference(listing.php?id=3) displaying on the page and a prompt pops up to download the image!?! Below is the code i have to receive the image:
PHP Code:
$sql_img "SELECT img_name,img_size,img_type,img_content FROM listings WHERE id = ".$_GET['id']." LIMIT 1";
$data_img mysql_query($sql_img);
list(
$name,$size,$type,$content) = mysql_fetch_array($data_img);

header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name"); 
And im displaying it like so:
Code:
<img src="listing.php?id=3">
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 17-11-2007, 10:40 AM
babyboy808's Avatar
Wannabe Geek
Recent Blog: teh-C peng
 
Join Date: Jan 2007
Location: everywhere
Posts: 298
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
babyboy808 will become famous soon enough
Default

Wouldn't displaying it at "listing.php?id=3" only be html?

You need to insert the variable that you created for the image into the img.

something like: <img src="$data_img" alt="" />
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 17-11-2007, 04:30 PM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 410
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
ziycon will become famous soon enough
Send a message via MSN to ziycon Send a message via Skype™ to ziycon
Default

Quote:
Originally Posted by babyboy808 View Post
Wouldn't displaying it at "listing.php?id=3" only be html?

You need to insert the variable that you created for the image into the img.

something like: <img src="$data_img" alt="" />
That doesn't work either, just prompts me to download the images again!?!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 17-11-2007, 07:41 PM
georgiecasey's Avatar
Member
 
Join Date: Jul 2006
Location: Galway / Ennis
Posts: 277
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
georgiecasey will become famous soon enough
Send a message via ICQ to georgiecasey
Default

Get rid of header("Content-Disposition: attachment; filename=$name");

That forces the browser to download.
__________________

My Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
blob, mysql, problem

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Connecting to 2 Mysql database in the same script?? Ciarán Mc Cann Coding Help 11 24-07-2007 10:21 AM
PHP mySQL Problem!? ziycon Server / Technical Administration Tips and Queries 1 15-07-2007 08:31 PM
mysql 3rigena Webmaster Discussion 4 24-05-2007 09:33 PM
MySQL Optimisation? blacknight Server / Technical Administration Tips and Queries 5 15-01-2007 05:17 PM
CSV to MySQL Conversion Tools? blacknight Coding Help 7 04-01-2007 11:00 AM


Sponsored links

Paid On Results


All times are GMT +1. The time now is 04:24 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0