Jump to content

[SOLVED] HTML Formatting from Stored Data


Recommended Posts

I have stored text in a mysql db with html formatting.  When I look at the stored data in 'events_body' in PHPmyAdmin, it looks like:

 

<p>This is some <strong>sample text</strong>. My website is <a href="http://www.allyourssolutions.com/">All Yours Solutions</a></p>

 

I am trying to retrieve and echo 'events_body' on http://estesparkeventplanners.com/events.php using the following code:

 

<?  
$result = mysql_query("SELECT * FROM events")
or die(mysql_error());  

// store the record of the "events" table into $row
$row = mysql_fetch_array( $result );

// Print out the contents of the entry 
echo htmlspecialchars($row['events_body']); 
?>

 

If you go to http://estesparkeventplanners.com/events.php, you'll see my problem is that it's outputting as if it's straight-up text, without the HTML formatting.  I need it to interpret the HTML tags as HTML. 

 

MySQL client version: 4.1.22

php5

 

Any help is greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/128395-solved-html-formatting-from-stored-data/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.