PDA

View Full Version : Allow HTML into Database field


UrbanTwitch
09-28-2009, 10:21 PM
From a web page and a Simple MySQL insert... I try to write some HTML with image tags, span tags, basically a tutorial filled with apostrophes, and tags. Anyway, when I try to insert it... I get the error saying I have a syntax error and it's because of my apostrophe...

So.. how do I allow HTML into a textfield?
It's a VARCHAR.

Old Pedant
09-28-2009, 11:43 PM
Depends on what your server-side language is.

If it's PHP, there's a function especially for this; it's a common question in these forums. I'm not a PHP person, so I don't remember it, but the PHP docs are easy to search. Okay, it took me two clicks to find it:
http://us2.php.net/manual/en/function.mysql-real-escape-string.php

If you aren't using PHP, tell us what you are using.

UrbanTwitch
09-29-2009, 09:50 PM
Thanks, that worked... for the most part but it doesn't see list items.. weird.