I have one MySQL database field which saves comment from users. Some comments have new lines but when I try to use PHP to display the contents of the database, the new lines are ignored. I know about nl2br() but I guess it will not work as my users will not bear to write /n or /r/n or /r.

My column type is LONGINT and another problem is that if quotation marks exist in the comment, the comment doesn't get stored in the database.

I have more information to provide, I use textarea and use "POST" method.

I want reply as soon as possible.

another problem is that if quotation marks exist in the comment, the comment doesn't get stored in the database.

for this use addslashes($str);

are your comment text?
The u can't store them in a longint. Just use TEXT as ur column type
If there are numerical i don't see the problem with new lines

I changed my column type to TEXT. Sorry my column's type was LONGTEXT before.
I have used nl2br in a different way and now it works :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.