Keeping the format of a text field in a MySQL database...
Posted: Sun May 05, 2002 3:49 pm
Hey all,
I've been trying to solve this one problem I'm having with a form and a MySQL database.
When a user enters information in a 'textarea' with physical wrap on my form, all of the carriage returns are lost producing one very, very long line of text when the info is recalled from the db.
I've done a bit of searching on the net and came across the command: $string = nl2br ($string); ... but this doesn't do anything (I'm probably using this command incorrectly). Should I use this command before I shoot the info onto the db or should this command be used when retrieving the text? Will this command even solve the problem?
Essentially, I want to store information in a format which resembles messages stored on a forum.
Any suggestions?
I've been trying to solve this one problem I'm having with a form and a MySQL database.
When a user enters information in a 'textarea' with physical wrap on my form, all of the carriage returns are lost producing one very, very long line of text when the info is recalled from the db.
I've done a bit of searching on the net and came across the command: $string = nl2br ($string); ... but this doesn't do anything (I'm probably using this command incorrectly). Should I use this command before I shoot the info onto the db or should this command be used when retrieving the text? Will this command even solve the problem?
Essentially, I want to store information in a format which resembles messages stored on a forum.
Any suggestions?