Solved

Reading BLOB content in phpmyadmin

Posted on 2008-01-16
9,914 Views
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.
0
Question by:Igiwwa
    1 Comment
     
    LVL 10

    Accepted Solution

    by:
    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'];
    
    }
     
    
    ?>
    

    Open in new window

    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    As you all know PHP got one problem, before using other files classes or functions you need to include or use require function. But now in PHP 5 there's solution for this, it's called __autoload() function. You can read more about function in PHP ma…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    933 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

    20 Experts available now in Live!

    Get 1:1 Help Now