0
votes

Cuz, I did it unintentionally. After reading wikipedia I understand the "binary large object" is for large media files, and I'm not saving a media file.

So how does data get stored this way? What's wrong with this setup to display text as BLOB in phpmyadmin?

the MySql field from phpmyadmin,
Field = 'first_name'
Type = text
Collation = latin1_bin
Null = No
Default = None

The php code, $insertName = "INSERT INTO name(first_name,last_name)VALUES('$firstName','$lastName')";
$dbSuccess_1 = mysql_query($insertName,$connectID) or die ("ERROR_1 - Unable to save to MySQL".error_get_last().mysql_error($connectID));

2
What is your question? I don't understand. - Pekka
If you are saying you want to store binary files in your database, that is wrong. You should store these on your file system and in your database store a reference to the file on the system. - Chris
I rewrote the q a little clearer... - xtian

2 Answers

1
votes

If you're asking how to change a BLOB column to TEXT you would use a query similar to this:

ALTER TABLE `name`  
    CHANGE COLUMN `first_name` `first_name` TEXT NULL FIRST
    ,CHANGE COLUMN `last_name` `last_name` TEXT NULL AFTER `first_name`;

You can use PHPMyAdmin to make the change even easier.

0
votes

TEXT and BLOB are essentially identical, except that TEXT fields are subject to character set limitations (and character set is taken into account while sorting/grouping the fields), while BLOBs are stored verbatim as a sequence of bytes and will not be transformed.

Relevant docs: http://dev.mysql.com/doc/refman/5.0/en/blob.html