Reading BLOB content in phpmyadmin

Posted on 2008-01-16
Last Modified: 2013-12-12
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.
Question by:Igiwwa
    1 Comment
    LVL 10

    Accepted Solution

    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.

    // 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'];

    Open in new window


    Featured Post

    Easy Project Management (No User Manual Required)

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now