开发者

Max allowed size in Text field of MySQL

I am doing a project where开发者_如何转开发 user can post text, i have used TinyText.

i need to know how much input user should be allowed to do ? i came to know TinyText allows only 255 characters to be entered from http://www.htmlite.com/mysql003.php

But if a user enters & then it have to be converted to &amp and so...

So what should be the ideal size allowed to be inputted from the users for these field/data types

TinyText

Text

User can insert data, but can not edit !

An user can view others data !

So, view will be used mostly !


Here you can find details about MySQL text type: http://dev.mysql.com/doc/refman/5.0/en/blob.html


I don't think replacing html entities and insert them into your database lets you control the final length that is inserted into your tinytext.

I'd go for 2 options.

  1. Insert raw data into the database, and use htmlentities on outputting.
  2. Restrict it to an maximum amount of characters, but use a larger text-type.

Depending on your application I'd pick one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜