Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,556 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,344 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



question about MySQL and datatypes

 
Reply to this topicStart new topic

question about MySQL and datatypes, which date type should I use

rjolitz
post 5 Aug, 2008 - 10:20 PM
Post #1


D.I.C Head

Group Icon
Joined: 17 May, 2008
Posts: 83



Thanked 1 times

Dream Kudos: 75
My Contributions


Morning.

I have setup a table in a MySQL database to store news items for a fan club chapter I'm in. What I'm not sure about is - is there a data type that will preserve the text as entered into a <textarea> on a form?

As it stands, if you put in two paragraphs, the data is printed as a single paragraph when pulled with a query.

I'm using longtext now.

Or am I missing something ultra simple here?
User is offlineProfile CardPM

Go to the top of the page


AdaHacker
post 6 Aug, 2008 - 08:23 AM
Post #2


D.I.C Head

**
Joined: 17 Jun, 2008
Posts: 76



Thanked 10 times
My Contributions


This has nothing to do with the database. I'll bet that if you look at the page source, your data is coming out exactly as you put it in.

Your problem is that, by default, line breaks aren't shown in HTML. You need to either adjust the data to change the line breaks to <BR> or paragraph tags, or you need to change the CSS on your display area to include the "white-space: pre" style. That will display spaces and line breaks as they would be in plain text.
User is offlineProfile CardPM

Go to the top of the page

rjolitz
post 7 Aug, 2008 - 10:17 AM
Post #3


D.I.C Head

Group Icon
Joined: 17 May, 2008
Posts: 83



Thanked 1 times

Dream Kudos: 75
My Contributions


QUOTE(AdaHacker @ 6 Aug, 2008 - 10:23 AM) *
This has nothing to do with the database. I'll bet that if you look at the page source, your data is coming out exactly as you put it in.

Your problem is that, by default, line breaks aren't shown in HTML. You need to either adjust the data to change the line breaks to <BR> or paragraph tags, or you need to change the CSS on your display area to include the "white-space: pre" style. That will display spaces and line breaks as they would be in plain text.


okay... I'll look into trying that and see if that fixes it. Of course now I've got a new wrinkle to puzzle out since this post too.

I appreciate it!


User is offlineProfile CardPM

Go to the top of the page

jjsaw5
post 8 Aug, 2008 - 12:18 PM
Post #4


D.I.C. Face

Group Icon
Joined: 4 Jan, 2008
Posts: 984



Thanked 5 times

Dream Kudos: 125
My Contributions


I would make sure that you set the database feild to VARCHAR so that you insure all charactes will be accepted.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/7/08 11:09PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month