Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading BLOB content in phpmyadmin

Posted on 2008-01-16
1
Medium Priority
?
10,254 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
Comment
Question by:Igiwwa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
ray-solomon earned 2000 total points
ID: 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'];
}
 
?>

Open in new window

0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 …
Suggested Courses

618 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