|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I am trying to load content from a MySQL DB that need to be formatted in multiple ways.
For example, lets say I have a news article that I want to store in MySQL and the article contains links and lists and bold type sections and other formatting...how to I keep the article's formatting when I load it into a PHP page? Do I have to split it up into it's different sections and then retrieve it with formatting hard-coded into the page?? That would be highly inefficient! Thanks. |
|
#2
|
|||
|
|||
|
im not too sure what you mean by this, could you post some examples?
|
|
#3
|
|||
|
|||
|
Ben,
sorry about the long-winded explanation. I figured out how to do it. What I wanted was to take an article and post it from a database with HTML formatting intact. Well, that was easy, I just wrote my HTML tags into the article and inserted it into MySQL as a BLOB. It works great. |
|
#4
|
|||
|
|||
|
Quantum,
You shouldn't have to store it as a BLOB... It's an inefficient way of doing so. If you want to be able to keep all the HTML formatting when storing the info in a db, use the PHP function, htmlspecialchars(). The function will keep your formatting for when you retrieve it back from the db. Also, you may want to take a look at the htmlentities(). Hope it helps.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction Last edited by FrankieShakes : October 23rd, 2002 at 06:38 PM. |
|
#5
|
|||
|
|||
|
You should only need to store data as a blob if its not text based, such as exe files, mp3s, images, etc
|
|
#6
|
|||
|
|||
|
Exactly... BLOB stands for Binary Large OBject, which is made purposely for binary files. I would recommend the above methods...
Let us know how it works out... |
|
#7
|
|||
|
|||
|
Thanks for the suggestions everyone.
I am storing the data as a TEXT type and not a BLOB, my mistake. I should have made that clear in my first post...sorry. Since I have largely varying sizes for the text I am storing I figured the TEXT type would be best. I am not indexing the fields though, so there shouldn't be a problem with speed. So far it works fine. I am storing the content with HTML and CSS formatting embedded and It displays correctly in the browsers. I'll read up on htmlspecialchars() and htmlentities() and possibly use those. Thanks again. |
|
#8
|
|||
|
|||
|
Quote:
No problems! thats what we are here for. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Load article from DB with multiple formatting? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|