Page 1 of 1

Saving HTML "textarea" to a MySQL database

Posted: Tue Jun 20, 2006 12:15 pm
by Bigun
I'm attempting to save a HTML textarea to a MySQL database.

It kinda works, except it doesn't seem to like newlines.

Like:

Code: Select all

foo

bar
Only Saves:

Code: Select all

foo
What gives?

Posted: Tue Jun 20, 2006 12:46 pm
by RobertGonzalez
What is the field type in your table?

Posted: Tue Jun 20, 2006 12:56 pm
by Bigun
varchar(255)

Posted: Tue Jun 20, 2006 1:49 pm
by RobertGonzalez
I'm not sure a varchar() field can handle text type stuff. Try changing the field type to text and see if that does anything different.

Posted: Tue Jun 20, 2006 2:26 pm
by feyd
varchar is a text type. It can handle it, the problem can easily be that the code you've entered is longer than 255 characters, the limit of your field.

Posted: Tue Jun 20, 2006 2:28 pm
by Bigun
Bingo... that did it.