Jump to content

to blob, or varchar?


141n

Recommended Posts

Hey guys, just a quick question. I'm setting up a site thats going to contain a blog section of sorts. It's the first time I've attempted this and was wondering, when setting up the MySQL Database which field type to use to store the main content as. I.e, VARCHAR, LONGTEXT, LONGBLOB?

 

I'd appreciate the reply or even a clarifcation of the difference and which is best suited ^^

 

Many Thanks, Iain

Link to comment
https://forums.phpfreaks.com/topic/98227-to-blob-or-varchar/
Share on other sites

VARCHAR has a max character length of 255 characters. SO obviously this will not suite your needs. When storing large quantities of text within a database use TEXT or LONGTEXT

VARCHAR is now up to 65K in v5 -- almost no need to ever use TEXT, which is *very* evil.

Link to comment
https://forums.phpfreaks.com/topic/98227-to-blob-or-varchar/#findComment-503607
Share on other sites

^^

 

Thanks for clearing up the air folks. Well, that answers my question. It is MySQL5 I'm using so I guess VARCHAR would be OK with the 65,000 character limit - I doubt I will go over that, or BLOB, I guess I can research the nitty-gritty details on my own.

 

Oh, another thing - I am going to be the sole user of this, so security shouldn't be *much* of an issue (I'm not naive enough to rule out the risk of someone else gaining access to the posting form) but what is, generally, a better method of styling my input. Should I code some kind of BB style app, or, as I am going to be the sole user, should I just go ahead and stick in the normal HTML tags? I know allowing unformatted HTML input isn't always a great idea, but I just wondered what your opinions were?

 

And, fenway, can you clear up on why TEXT is evil =P

 

Thanks again!

Link to comment
https://forums.phpfreaks.com/topic/98227-to-blob-or-varchar/#findComment-503781
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.