Home  >  Article  >  Backend Development  >  PHP method to operate BLOB fields in MySQL

PHP method to operate BLOB fields in MySQL

巴扎黑
巴扎黑Original
2017-09-18 10:09:173852browse

This article mainly introduces the method of PHP operating BLOB fields in MySQL. It analyzes the related operation skills of PHP using mysql's BLOB fields to store news content and pictures based on specific examples. Friends who need it can Refer to the

related mysql video tutorial recommendations: "mysql tutorial"

This article describes how PHP operates BLOB fields in MySQL. Share it with everyone for your reference, the details are as follows:

1. BLOB field type in MySQL

BLOB type fields are used to store binary data .

In MySQL, BLOB is a type series, including: TinyBlob, Blob, MediumBlob, LongBlob. The only difference between these types is the maximum size of the stored file.

MySQL’s four BLOB types

TinyBlob: Maximum 255 bytes
Blob: Maximum 65K
MediumBlob: Maximum 16M
LongBlob: Maximum 4G

Note: If the file you store is too large, the performance of the database will drop a lot.

2. PHP operation BLOB case

(1) Operation news content

(2)Storing pictures

The above is the detailed content of PHP method to operate BLOB fields in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn