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

Join 136,529 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,830 people online right now. 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
5 Aug, 2008 - 09:20 PM
Post #1

D.I.C Head
Group Icon

Joined: 17 May, 2008
Posts: 86



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
+Quote Post

AdaHacker
RE: Question About MySQL And Datatypes
6 Aug, 2008 - 07:23 AM
Post #2

D.I.C Head
**

Joined: 17 Jun, 2008
Posts: 176



Thanked: 27 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
+Quote Post

rjolitz
RE: Question About MySQL And Datatypes
7 Aug, 2008 - 09:17 AM
Post #3

D.I.C Head
Group Icon

Joined: 17 May, 2008
Posts: 86



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
+Quote Post

jjsaw5
RE: Question About MySQL And Datatypes
8 Aug, 2008 - 11:18 AM
Post #4

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,404



Thanked: 6 times
Dream Kudos: 125
Expert In: HTML, CSS, Database,

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
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 09:53PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month