miket3 Posted August 19, 2009 Share Posted August 19, 2009 ok... I decided to store my images in a DB. I have most of it working except I cant copy BLOB from one record to another record... Has anybody done this? I can read binary file contents into a variable and then store it in the database without issue. What is so different about grabbing BLOB data from a field into a variable and back into a BLOB field? Heck it will even display fine after being grabbed from the BLOB. BUt what is missing when trying to do this: BLOB -> $image -> BLOB I can do: FILE.PNG -> $image -> BLOB and BLOB -> $image -> SCREEN but not: BLOB -> $image -> BLOB here is some code: $couponid = $_REQUEST["couponid"]; $memberid = $_REQUEST["memberid"]; $result = mysql_query("SELECT image FROM ".COUPONTABLE." WHERE memberid = '".$memberid."' AND couponid = '".$couponid."'"); $row = mysql_fetch_assoc($result); $image = $row[image]; $result = mysql_query("UPDATE ".COUPONTABLE." SET image=".$row[image]." WHERE memberid = '11' AND couponid = 'buddy4-4'"); header("Content-type: image/png"); print $image; Thanks, There is a little trick to this or a bug? Link to comment https://forums.phpfreaks.com/topic/171068-solved-php-and-blob/ Share on other sites More sharing options...
miket3 Posted August 20, 2009 Author Share Posted August 20, 2009 Hey... I have an idea.... How about next time I make sure that the source record actually has data in the BLOB field before trying to copy it to other records. it was a combo... I also learned that you ALWAYS need to use ADDSLASHES() to assign binary data to a variable. Link to comment https://forums.phpfreaks.com/topic/171068-solved-php-and-blob/#findComment-902226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.