Hello all!
I'm trying to store HTML code in MySQL, to then be rendered from the database as part of a website. The problem I'm having is that the HTML is not rendering when pulled from the database. Instead, the script is treating the entire MySQL field as text and displaying it. For example, instead of rendering "This is my text.", it is simply displaying "<b>This is my text</b>."
The content is stored in a 'text' field, and inputted using a HTMLArea-like WYSIWYG editor. I'm retreiving it in the following way...
// header.php
// this function retrives the data from MySQL and stores it in $string.
function retrieve_content($section){
$query="SELECT * FROM tblContent WHERE section='$section'";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
$string = stripslashes(trim($row[content]));
return $string;
}
// main.php
// print content
echo retrieve_content('home');
Does anyone have any suggestions? Am I just making some stupid mistake somewhere?- this has been driving me nuts!
Thanks!