MySQL text formatting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Damian2020
Forum Newbie
Posts: 10
Joined: Thu Aug 20, 2009 5:25 am

MySQL text formatting

Post by Damian2020 »

I am trying to store text with HTML formatting in a MySQL Database.

When I call the text from a swf on my webpage, it has been stripped of it's formatting. This is the flow of the data:
swf > php > mysql > php > swf

I inserted the text using phpMyAdmin fom the site's control panel. Like so:

UPDATE cms_content SET company_body='<p><b>This is a bold heading</b><br/>This is the body text.<a href = "www.website.com">This is a link</a><br/>This is some more body text.</p>'

In the swf, the text displays as one continous paragraph with no bold, italic or color formatting. (the text fields are set to display html text and I have tested this with txt files) Where is the formatting getting lost? Or am I putting the data into the database wrong?

Thanks.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: MySQL text formatting

Post by jackpf »

If you look at the record in phpmyadmin, does it have the html still there?

If so then it's probably something to do with flash, in which case I will step back and let someone more knowledgeable take over...
Damian2020
Forum Newbie
Posts: 10
Joined: Thu Aug 20, 2009 5:25 am

Re: MySQL text formatting

Post by Damian2020 »

I just figured out I need to try something:

I was using tags like <strong></strong> and <em></em> but Flash only supports certain tags, so <b></b> and <i></i> might work. It also doesn't automatically set the color of links, you need to specify it in the html code. I've managed to set the correct line breaks so maybe I'm on to something here.

I'm going to very annoyed if I find out that it took me almost 2 days to figure out something that simple.

I'll post the results in case anyone is interested.
Post Reply