MySQL Forums
Forum List  »  Docs

MYSQL Enter key problem
Posted by: Somnath Guha
Date: September 05, 2008 08:48PM

I am facing a problem while I am trying to add some data through a form textarea. Let say I have a address field in form. I am using textarea for that. I have a mysql table which has a `address` column and type has been specified as varchar(150). I have also added a JavaScript counter to restrict user to enter more than 150 characters. If user enters 250 characters without pressing enter button within the textarea data has been inserting properly in mysql table. But when user press enter button betwwen 2 lines and entering 150 characters data is not inserting in database properly, example:
aaaaaaaaaa
bbbbbbbbbb
cccccccccc
dddddddddd
eeeeeeeeee
ffffffffff
gggggggggg
hhhhhhhhhh
iiiiiiiiii
jjjjjjjjjj
kkkkkkkkkk
llllllllll
mmmmmmmmmm
It's inserting data in following format
aaaaaaaaaa
bbbbbbbbbb
cccccccccc
dddddddddd
eeeeeeeeee
ffffffffff
gggggggggg
hhhhhhhhhh
iiiiiiiiii
jjjjjjjjjj
kkkkkkkkkk
llllllllll
mmmmmm
As you can see from above that data has been truncated. I have found out the reason. As we all know enter key equivalent to '\n'. Mysql is treating this 'n' as a character. Can we specify this '\n' as a escape character like '\'?

Best Regards,
Somnath Guha

Options: ReplyQuote


Subject
Views
Written By
Posted
MYSQL Enter key problem
9526
September 05, 2008 08:48PM
4169
February 17, 2009 06:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.