Data Types mysql between varchar and mediumtext size

6 posts by 4 authors in: Forums > CMS Builder
Last Post: April 21, 2015   (RSS)

By Twocans - April 17, 2015

Hello,

I would be grateful for any input.

When setting values for my user input I have the option of varchar which is cool but only 255 char. Sometimes I need something max 2000 char but feel it is such a waste to have to set mediumtext as that is 16 odd meg and wowa, I do not want to give so much option. I see there is an option of setting other custom mysql column type and that gets me excited but having looked into it, in MySQL I am not really given much options. 

Is there a way of my setting a char type thus allowing me a max of 2000 char.

regards

Kenny

By Djulia - April 17, 2015

Hello,

Yes, you can use the option Other/Custom in the select MySQL Column Type :

TEXT

http://stackoverflow.com/questions/5053658/mysql-varchar2000-vs-text

Djulia

By gregThomas - April 17, 2015 - edited: April 17, 2015

Hey Twocans,

The easiest option would be to use mediumText, and then limit the users input to 2000 characters using the max length setting when editing a field. If you use the option suggested by Djulia, ensure that you set the max length to 2000 characters or you might get MySQL errors if a user enters too many characters.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Twocans - April 18, 2015

Thank you,
Excuse my ignorance but when I read tutorials etc they never come across as too clear to me.

mediumText  states in the cms gui  max 16 meg.

My question is

Were I to use datatype as mediumText and set max char size to 2000, does this mean every time a record is created I use up 16 meg weight of the data base space?

Or

By setting mediumText and setting max char size to 2000 does that mean, when ever a record is created I use up to 2000 char space/weight of my database?

Sometimes these things are not so clear, and no matter what I search and read etc they never give a straight forwardish answer.

I have very grateful to you both and others for any input.

cheers

Kenny

By Twocans - April 21, 2015

Thank you all very much,

Excellent advice.

regards and thanks again

Kenny