General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old October 22nd, 2002, 03:28 PM
Quantum Quantum is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Canada
Posts: 15 Quantum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Load article from DB with multiple formatting?

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.

Reply With Quote
  #2  
Old October 22nd, 2002, 08:06 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
im not too sure what you mean by this, could you post some examples?

Reply With Quote
  #3  
Old October 23rd, 2002, 11:28 AM
Quantum Quantum is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Canada
Posts: 15 Quantum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old October 23rd, 2002, 06:28 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
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.

Reply With Quote
  #5  
Old October 23rd, 2002, 07:40 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
You should only need to store data as a blob if its not text based, such as exe files, mp3s, images, etc

Reply With Quote
  #6  
Old October 24th, 2002, 02:57 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
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...

Reply With Quote
  #7  
Old October 24th, 2002, 08:11 PM
Quantum Quantum is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Canada
Posts: 15 Quantum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #8  
Old October 24th, 2002, 08:34 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Quote:
Thanks for the suggestions everyone.


No problems! thats what we are here for.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > Load article from DB with multiple formatting?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway