Reading BLOB content in phpmyadmin

PHP Question

One of the fields in a database that I am working with in phpMyadmin has content in BLOB format. I want to read what this content is and browse it. But phpMyadmin doesn't display the content. So what should I do? I changed the settings in config.ini.php to
$cfgShowblob              = TRUE;
but doesnt that seem to have changed anything? (do i need to do something to make the changes in config.ini.php take effect?)
i know i can also dump the db thru ssh but i am having trouble doing that so I would like a solution that doesnt involve doing that.

 

Verified Answer?

The member who asked this question verified this comment provided the solution that solved their problem.

by:Posted on 2008-01-17 at 12:34:12ID: 20685081

blob data stands for "binary large object". It can be used to store binary data such as pictures, music, executables, etc. (Anything that is binary)

If you could see the binary data in an editor, it would look like a bunch of garbled junk text.

The way you read it is using a sql query to extract it from the database, then add a correct header, then output it to the browser.

<?php
 
// create a db connection
@mysql_connect('localhost', 'db_username', 'db_password') or die(mysql_error());
@mysql_select_db('database_name') or die(mysql_error()); 
 
$result = @mysql_query('SELECT blob_data FROM table') or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
	// change this header to the proper mime type
	header("Content-type: image/jpeg"); 
	echo $row['content'];
}
 
?>

                                          
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:

Select allOpen in new window

This content is available to Experts Exchange members

See the answer now
with your Free 30 Day Trial

Get unlimited access to solutions & experts

  • 4,169,477 solved questions
  • 3,805 articles & videos
  • 15,413 tech experts

Get Access Now

Need a customized answer?
Ask your question for one-on-one assistance. We will email you when an expert has commented on your question.

We will never share this with anyone.

201505-LO-Qu-057

Related Articles

Related Questions

Experts Exchange powers the growth and success
of technology professionals worldwide.

  • Solve

    Experts Exchange is the tech professional’s trusted, on-demand resource for solving difficult problems, making informed decisions, and delivering excellent solutions.

  • Learn

    With unparalleled access to technical experts, verified real-world solutions, and diverse educational content, Experts Exchange enables personalized development of technology skills.

  • Network

    Experts Exchange gives you the professional exposure and valued relationships key to building the career you want.

Join the Network Today

See Plans and Pricing