views:

7

answers:

1

I am creating such application where user can post there articles upto 800-1000 words . What should I use to maintain text formating like paragraph, next line etc.(if i use textarea as input textbox for article?). I am using mySql so what shod my datatype to store article text VARCHAR or TEXT?? and what shoud be the size for 1000 words?

A: 

With VARCHAR you can store up to 65000 bytes. If you need more, you'll need to move to MEDIUMTEXT (16 million bytes). For utf8 you should calculate two bytes per character.

You don't need to do anything special to preserve line breaks when storing data to MySQL. You need however process these linebreaks into adequate html tags <br> when pulling the data from database for displaying. Gor example PHP has nl2br() function.

Mchl