Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Parsing data to/from mysql database

Options
  • 16-11-2006 2:43am
    #1
    Closed Accounts Posts: 8,866 ✭✭✭


    I was wondering how difficult it is to do? I've written a small blog system for a personal website, nothing fancy at all, but I now need to know how to get it into and out of the database "as is", for example if I write a blog like:

    "The world is shít.

    We're all going to die."

    ...firstly I'd be weird... but more importantly, it would print out like this:

    "The world is shít. We're all going to die."

    How do I do things like maintain paragraphs, breaks, and even further along, allow for links and images? Cheers guys!


Comments

  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Mirror wrote:
    How do I do things like maintain paragraphs, breaks, and even further along, allow for links and images? Cheers guys!
    By formatting it - essentially parsing the input and converting certain characters to HTML entities. The most basic formatting you can do is replacing carriage returns to <br/>'s or, better still, encapaulating your paragraphs in <p></p>'s. Additionally you'd want to look at other entities, such as &, € and the like.


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Any good tutorials out there on how to do this? I haven't done much string manipulation so I wouldn't even know where to start.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Mirror wrote:
    Any good tutorials out there on how to do this? I haven't done much string manipulation so I wouldn't even know where to start.
    Depends upon the language you're coding in. I suggest you use Google.


  • Registered Users Posts: 378 ✭✭sicruise


    Generally the end of line character is \n so you can replace this with <br/>


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    I'm using PHP, and the input is just a textarea, which I want to be pretty much a WYSIWYG editor.


  • Advertisement
  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Mirror wrote:
    I'm using PHP, and the input is just a textarea, which I want to be pretty much a WYSIWYG editor.
    Then I suggest that you use a third party client-side plugin like the FCKeditor.


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Thats the trick, nice one Corinthian! ;)


Advertisement