将文本段落保存到mysql [英] Saving paragraph of text to mysql

查看:316
本文介绍了将文本段落保存到mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用php和mysql做一个项目(这是我的新手),现在我必须将一段文本存储到我的数据库中(在表中,用于一列).

我在创建表时尝试了"varchar(5000)",但是它不允许我进行. 所以请给我一个解决方案.

解决方案

在MySQL 5.0.3和更高版本中,大于255的CHAR长度是非法的,并因错误而失败

使用text

create table t (long_field text);

text最多可以存储65,535个字符.

请参见 MySQL数据类型文档

I am doing a project using php and mysql(i am new to this), now i have to store paragraph of text to my database(in a table, for a column).

I tried "varchar(5000)" when creating the table but it doesn't allow me. so please give me a solution for this.

解决方案

In MySQL 5.0.3 and later, a CHAR length greater than 255 is illegal and fails with an error

use text

create table t (long_field text);

textcan store up to 65,535 characters.

See MySQL datatype doc

这篇关于将文本段落保存到mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆