Textfield Database Storage!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bumple
Forum Commoner
Posts: 34
Joined: Thu Jan 08, 2004 4:38 am

Textfield Database Storage!

Post by bumple »

Hey all,

I was wondering, for a web site that wants to store about seven fields, all containing 1,000 characters each, what type of variable (TEXT, LONGTEXT?) would I use with MySQL? For example, what does this forum use?

Thanks!
-BUMPle.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

LONGTEXT, because TEXT only allows 255 characters and when adding a LONGTEXT field to MySQL (if your using that) you dont need to enter a value for it :)
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

Correction a "TEXT" field allows 2^16 - 1 characters (65535... as does BLOB)
TINYTEXT allows only 2^8 - 1 (255) characters.
LONGTEXT allows 2^32 - 1 (approx 4G or 4294967295)

see http://www.mysql.com/doc/en/Column_types.html for more information.

So, my answer would be TEXT not LONGTEXT ( LONGTEXT can make the db slower )
Post Reply