I have a column in SQL ‘Text’ datatype and inside I have content within html tag, eg
somecontent:
- one
- two
… I want the mysql query to echo out the databases contents without stripping the html tags (its possible this is done by php for security reasons or?) so that the html code will render if you get me? At the moment it just lumps out a paragraph which looks aweful! It should be noted security is not much of a concern as this is a project and not going to be exposed publicly
Cheers folks
Nick
MySQL wouldn’t strip tags from text – it couldn’t care less what the text is. PHP also wouldn’t strip tags, unless somewhere in your code you do a
strip_tags()or equivalent.If you want to force the browser to display the tags in the retrieved data, you can run the string through [
htmlspecialchars()][1], which converts html metacharacters (<,>,",&, etc…) to their character entity equivalents (<,>, etc…).Or you can force the entire page to be rendered as plain text by doing