WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox 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.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-14-2007, 02:51 PM
madmanlear madmanlear is offline
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, 05:22 PM
speed speed is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 824
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.
__________________
TOLRA Micro Systems Limited US & UK Web Hosting with Continuous Data Protection
Web Directory : Web Directory Script
Reply With Quote
  #3 (permalink)  
Old 03-14-2007, 06:15 PM
madmanlear madmanlear is offline
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
Tags: database, images, mysql



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0