|   |   |   | ||||
| Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. | 
|    | 
| 
 | |||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
|  | Thread Tools | 
|  08-28-2008, 10:45 AM | #1 | 
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | 
				
				Php/mysql display BLOB field data?
			 does anyone know how to display the data that is kept in a BLOB field format? I can only find examples that should how to display an image if saved to BLOB format type but nothing on how to display text. there should be data for two dropdown menu's and two textbox stored in m_addtn field <?php $res = mysql_query("SELECT m_addtn FROM s_viz WHERE m_id = '39'"); $result = mysql_fetch_assoc($res); echo $result; ?> | 
|   |           | 
|  08-28-2008, 10:45 AM | #2 | 
| Confirmed User Join Date: Oct 2007 Location: No longer with Star Marketing Group. 
					Posts: 700
				 | A blob field is usually considered to be binary data. You're gonna want to escape that. If you want to display text, you should use TEXT or TINYTEXT and not BLOB for storage. 
				__________________ I no longer represent TrafficGigolos, please contact Justin or Rebecca with any issues. | 
|   |           | 
|  08-28-2008, 11:43 AM | #3 | |
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | Quote: 
 this code below just shows me the encoded info, i need to decode it $res = mysql_query("SELECT m_addtn FROM s_viz WHERE m_id = '39'"); $result = mysql_fetch_array($res); echo var_dump($result); | |
|   |           | 
|  08-28-2008, 11:49 AM | #4 | 
| Confirmed User Join Date: Oct 2007 Location: No longer with Star Marketing Group. 
					Posts: 700
				 | If it was serialized, it'd likely be base64 encoded afterwards; why it was stored as a blob well, that's kind of dumb.  Try print_r($result) to see what's in your array. Or, you can always: PHP Code: 
			
				__________________ I no longer represent TrafficGigolos, please contact Justin or Rebecca with any issues. | 
|   |           | 
|  08-28-2008, 11:57 AM | #5 | 
| Confirmed User Join Date: Nov 2004 Location: scv 
					Posts: 2,299
				 | See how the insert is done and what kind of encoding is being used. | 
|   |           | 
|  08-28-2008, 12:47 PM | #6 | 
| Too lazy to set a custom title Industry Role:  Join Date: May 2004 Location: West Coast, Canada. 
					Posts: 10,217
				 | What bigben said... sometimes you'll compress text data and store it in a blob | 
|   |           | 
|  08-28-2008, 12:56 PM | #7 | 
| Too lazy to set a custom title Industry Role:  Join Date: Sep 2005 Location: Springfield 
					Posts: 13,826
				 | what are you saving in database as blob. If you are saving whole files (images etc...) in database that's bad so try to avoid that any way you can. 
				__________________ Make a bank with Chaturbate - the best selling webcam program       Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!! PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:   | 
|   |           | 
|  08-28-2008, 12:57 PM | #8 | |
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | Quote: 
 with print or echo Array ( [0] => YTo0OntpOjM7czo4OiJCaXNleHVhbCI7aTo2O3M6ODoiSW52b2 x2ZWQiO2k6NDtzOjIxOiJJIEFEREVEIFNPTUUgTkVXIFBJQ1Mi O2k6MTtzOjI5OiJUSEVZIFIgSU4gVEhFIEVYUExJQ0lUUyA0IE 5PVyI7fQ== [m_addtn] => YTo0OntpOjM7czo4OiJCaXNleHVhbCI7aTo2O3M6ODoiSW52b2 x2ZWQiO2k6NDtzOjIxOiJJIEFEREVEIFNPTUUgTkVXIFBJQ1Mi O2k6MTtzOjI5OiJUSEVZIFIgSU4gVEhFIEVYUExJQ0lUUyA0IE 5PVyI7fQ== ) with foreach statement 0 is YTo0OntpOjM7czo4OiJCaXNleHVhbCI7aTo2O3M6ODoiSW52b2 x2ZWQiO2k6NDtzOjIxOiJJIEFEREVEIFNPTUUgTkVXIFBJQ1Mi O2k6MTtzOjI5OiJUSEVZIFIgSU4gVEhFIEVYUExJQ0lUUyA0IE 5PVyI7fQ== m_addtn is YTo0OntpOjM7czo4OiJCaXNleHVhbCI7aTo2O3M6ODoiSW52b2 x2ZWQiO2k6NDtzOjIxOiJJIEFEREVEIFNPTUUgTkVXIFBJQ1Mi O2k6MTtzOjI5OiJUSEVZIFIgSU4gVEhFIEVYUExJQ0lUUyA0IE 5PVyI7fQ== | |
|   |           | 
|  08-28-2008, 01:01 PM | #9 | 
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | the m_addtn BLOB field is all test/data... the original coder did it that way. I'm just trying to clean things up. In the end I'll insert the text data in 4 separate fields the way it should of been done originally. First task is to decode the data from the BLOB and retrieve it, then insert into m_status, m_ori, m_turn1 and m_turn2 | 
|   |           | 
|  08-28-2008, 01:18 PM | #10 | |
| Confirmed User Industry Role:  Join Date: Jun 2004 Location: New York, NY 
					Posts: 6,890
				 | Quote: 
 Just find what's done to the text before it's inserted, then reverse that when it comes out. A BLOB field itself doesn't do its own encrypting or anything. On the small chance there is nothing being done to the data before it's put into the database, check for any Triggers in MySQL as there could be one that ON INSERT or ON UPDATE encrypts the value in that field. 
				__________________ Skype variuscr - Email varius AT gmail | |
|   |           | 
|  08-28-2008, 01:57 PM | #11 | |
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | Quote: 
 $addtn = base64_encode(serialize($_POST['edit_add'])); $q = 'm_addtn="'.$addtn.'"'.$q; i tried this piece of code (below) but just received a T_String error print_r unserialize(base64_decode($results)); | |
|   |           | 
|  08-28-2008, 02:04 PM | #12 | |
| Confirmed User Industry Role:  Join Date: Jun 2004 Location: New York, NY 
					Posts: 6,890
				 | Quote: 
 if you want paste the few lines of code you have above that where it shows the fetching of the row, etc... 
				__________________ Skype variuscr - Email varius AT gmail | |
|   |           | 
|  08-28-2008, 02:44 PM | #13 | |
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | Quote: 
 $res = mysql_query("SELECT m_addtn FROM s_viz WHERE m_id = '39'"); $result = mysql_fetch_array($res); $decode = unserialize(base64_decode($results['m_addtn'])); print_r($decode); | |
|   |           | 
|  08-28-2008, 03:22 PM | #14 | |
| Confirmed User Join Date: Oct 2007 Location: No longer with Star Marketing Group. 
					Posts: 700
				 | Quote: 
 Looking at the foreach, it said it was a sub-branch [0], so, try: PHP Code: 
			
				__________________ I no longer represent TrafficGigolos, please contact Justin or Rebecca with any issues. | |
|   |           | 
|  08-28-2008, 03:29 PM | #15 | 
| Confirmed User Join Date: Oct 2007 Location: No longer with Star Marketing Group. 
					Posts: 700
				 | Dammit, I waited too long to edit: I just saw your very last post. You're setting $result, and resting $results; otherwise, you're on the right track. No idea why you'd be doing mysql_array("...",MYSQL_BOTH), but, whatever. 
				__________________ I no longer represent TrafficGigolos, please contact Justin or Rebecca with any issues. | 
|   |           | 
|  08-28-2008, 03:42 PM | #16 | 
| Confirmed User Join Date: Jan 2007 
					Posts: 190
				 | try doing a redecode after youve dumped the array PHP Code: 
			 | 
|   |           | 
|  08-28-2008, 05:18 PM | #17 | 
| Confirmed User Industry Role:  Join Date: Jun 2004 Location: New York, NY 
					Posts: 6,890
				 | as GigoloShawn said above, you are using the variable $results when it is $result heh. This line should produce what you want: echo unserialize(base64_decode($result[0][0])); (feel free to use the field name instead of that second 0 though, to make your code easier to read): echo unserialize(base64_decode($result[0]['m_addtn'])); 
				__________________ Skype variuscr - Email varius AT gmail | 
|   |           | 
|  08-28-2008, 05:21 PM | #18 | |
| Confirmed User Join Date: Oct 2003 Location: Atlanta 
					Posts: 2,840
				 | Quote: 
 thanks everyone for helping me out | |
|   |           | 
|  08-29-2008, 12:03 AM | #19 | 
| . . . Industry Role:  Join Date: Apr 2007 Location: NY 
					Posts: 13,724
				 | bumping some good expertise 
				__________________ __________________ Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad! Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs Check out the #1 WordPress SEO Plugin: CyberSEO Suite | 
|   |           | 
|  08-29-2008, 12:44 AM | #20 | 
| Confirmed User Join Date: May 2005 
					Posts: 2,737
				 | For future reference, Code: <pre><?php print_r($data); ?></pre> | 
|   |           |