开发者

What MySQL type for long descriptions with punctuation?

开发者 https://www.devze.com 2023-04-01 07:07 出处:网络
I\'m trying to store long descriptions with symbols such as $ and punctuation. The original type I used cut the text off early. The second type I used outputs the following...

I'm trying to store long descriptions with symbols such as $ and punctuation. The original type I used cut the text off early. The second type I used outputs the following...

"  Tickets are $13.00 for adults, $11.00 for seniors, $5.0开发者_开发技巧0 for children ages 5-11 and free for children under 5.  There is also a family rate of $35.00 available for 2 adults and up to 4 children. All prices include taxes.  Reservations are recommended. Please call            519-661-5000       or             1-800-265-2602       for reservations."

Is there a type I can use to avoid this? Or will I have to convert punctuation before I put it into the database?

The types I've tried are Varchar & Mediumtext.

EDIT: Size problem has been solved but still getting the 'Â Â ' characters.


Use the TEXT type. It can hold up to 65KB.

If you use the proper encoding (like UTF-8), there is no problem in storing puncturation characters.

You can also use MEDIUMTEXT or LONGTEXT if you need to store up to 16MB or 4GB in the field.

See MySQL data type storage requirement


Set the connection charset.

Put after making the connection:

mysql_query("SET NAMES UTF8");
0

精彩评论

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