开发者

How to unset BLOB with php/mysql?

开发者 https://www.devze.com 2023-01-13 16:55 出处:网络
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.

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_开发者_Python百科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));


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消