iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-14-2007, 03:51 PM
WebProWorld New Member
 
Join Date: Oct 2005
Location: Atlanta, GA
Posts: 9
madmanlear RepRank 0
Default Images in a MySQL Database

I have quite a brainteaser for you all.

On almost every website I create I use a MySQL backend in some form or another. And one of favorite things is MySQL's ability to store entire image files in BLOBs, and then output those with a little PHP. BUT! I have found no way to replace an image BLOB once it has been created. My PHP skills fail miserably. But I know it's possible, because I can do it through PHP MyAdmin.

This would be a huge asset to me, and I'm sure many others. So I got an Easter Basket for whoever can solve this one for me.
Reply With Quote
  #2 (permalink)  
Old 03-14-2007, 06:22 PM
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Cornwall, UK
Posts: 972
speed RepRank 1
Default

I assume you have some PHP that does an INSERT query to place the image in the BLOB therefore you just need to change the MySQL to issue an UPDATE query with the id of the image to replace.

You could also just change the INSERT to REPLACE providing that the image ID (this is the key you select on) is currently passed to the INSERT query.
Reply With Quote
  #3 (permalink)  
Old 03-14-2007, 07:15 PM
WebProWorld New Member
 
Join Date: Oct 2005
Location: Atlanta, GA
Posts: 9
madmanlear RepRank 0
Default

Thanks Speed. It turns out that I do need the UPDATE function, but for some reason it wasn't working in the same script that updates all the text fields as well. I still haven't figured out how to integrate it the way I need to, but your help led me to the answer I was looking for. Please email me where you'd like the Easter Basket sent!
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

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



All times are GMT -4. The time now is 10:24 AM.



Search Engine Optimization by vBSEO 3.3.0