Results 1 to 5 of 5

Thread: Break lines which are too long without gaps

  1. #1
    Join Date
    Jul 2007

    Question Break lines which are too long without gaps

    I've made sort of a forum with PHP/MySQL and almost everything is ok except for the fact that when a user enters a long line without spaces, it's viewed without line breaks and it causes to break the layout of the table the data is arranged with.

    I've thought that I might use the function nl2br(), but I'm not sure how to do it (before entering data on the DB, or afterwards on the output), or if there's no need to do it because there's something else better, for instance some CSS property.

    Any help on thie please?

  2. #2
    Join Date
    Jun 2003
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  3. #3
    Join Date
    Aug 2004
    You could use wordwrap() with the optional 4th parameter set to true.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Jul 2007
    Thanks a lot for your help!

  5. #5
    Join Date
    Jul 2007
    I have another little problem regarding this issue and I need your help again:

    I finally opted for using wordwrap, and I assigned a limit of characters so that too long lines without spaces were cut.

    But another issue comes up:
    As the characters have different widths, 100 sequential m's on a line would be much longer than 100 i's. Thus, the limit of characters will always be either too short if there are many narrow characters with quite a long limit or too long if there are many wide characters with quite a short limit, showing either too short containing cells or overflown cells respectively.

    Another suggestion to get around this?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles