问大家一个问题,一般字符串文本在mysql中用什么字段类型啊?我刚开始用的是varchar(255),插入数据时提示文本太长,后来我又换成了text(65000)类型,可是页面提交的时候不能插入数据,为什么?

解决方案 »

  1.   

    mysql最大varchar为255。
    你可以改为longtext后面不用写数值
      

  2.   

    楼上的你错了.现在mysql中的varchar已经支持最大65535字节的长度了.
      

  3.   

    不行的啊,换成longtext或者varchar(65535)都不行
      

  4.   

    [NATIONAL] VARCHAR(M) [CHARACTER SET charset_name] [COLLATE collation_name] A variable-length string. M represents the maximum column length. The range of M is 1 to 255 before MySQL 4.0.2, and 0 to 255 as of MySQL 4.0.2. Note: Trailing spaces are removed when VARCHAR values are stored. This differs from the standard SQL specification. In MySQL 4.1, a VARCHAR column with a length specification greater than 255 is converted to the smallest TEXT type that can hold values of the given length. For example, VARCHAR(500) is converted to TEXT, and VARCHAR(200000) is converted to MEDIUMTEXT. This is a compatibility feature. However, this conversion affects trailing-space removal. VARCHAR is shorthand for CHARACTER VARYING.