The Straight Dope

Go Back   Straight Dope Message Board > Main > General Questions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2001, 02:44 PM
Cardinal Cardinal is online now
Charter Member
 
Join Date: Apr 1999
Location: 742 Evergreen Terrace
Posts: 5,945
I'm wondering if anyone knows how to preserve text formtatting when pulling data from a MySQl database. We have a db full of text sentences, and when we pull from this to put sentences in games, etc, all the formatting like bold, underlining or italics is lost. Is there a way to keep this?
Reply With Quote
Advertisements  
  #2  
Old 03-03-2001, 04:15 PM
friedo friedo is online now
Charter Member
 
Join Date: May 2000
Location: Brooklyn
Posts: 19,252
How is the text formatted originally? SQL does not have any specification for styled text; all text data are stored in plain ASCII. If you must have formatting, you can store your text in psuedo-HTML.
__________________
Friedo
Ignoramus Primus

"And a singularly consistent investigation you have made, my dear Watson. I cannot at the moment recall any possible blunder which you have omitted."
-- Sir Arthur Conan Doyle, The Disappearance of Lady Frances Carfax
Reply With Quote
  #3  
Old 03-03-2001, 08:22 PM
Cardinal Cardinal is online now
Charter Member
 
Join Date: Apr 1999
Location: 742 Evergreen Terrace
Posts: 5,945
Thanks for the reply

We're originally doing the formatting and typing in MS Excel. The formatting seems (if I remember right) to exist in the database once it's pulled from the Excel sheets, but then disappears when we pull it out for games and quizzes on our web site.

As for psuedo-HTML, if you have any other specifics, I'd like to hear them, but I'll pass this on to those more technically minded than I.
Reply With Quote
  #4  
Old 03-03-2001, 08:50 PM
friedo friedo is online now
Charter Member
 
Join Date: May 2000
Location: Brooklyn
Posts: 19,252
How, exactly, are you pulling the data from the spreadsheets into the MySQL server? I'm just a little confused about what you mean when you say, "The formatting seems...to exist in the database once it's pulled from the Excel sheets..."

What database client are you using to put the data in there? Are you doing it directly from Excel (I dunno if that's even possible; I don't use Excel.)

My guess is you're pasting from the spreadsheet into the DB client where the formatting is maintained, and then that formatting gets stripped when the data is actually saved to the DB.

You mentioned that this is for a web site, so the most obvious solution would be to convert your formatting to HTML and store it like that. For example, if you have an item that's supposed to be bold, save it to the database as <b>this is the item</b>. I'm pretty sure Excel has a function for exporting stuff as HTML.
__________________
Friedo
Ignoramus Primus

"And a singularly consistent investigation you have made, my dear Watson. I cannot at the moment recall any possible blunder which you have omitted."
-- Sir Arthur Conan Doyle, The Disappearance of Lady Frances Carfax
Reply With Quote
  #5  
Old 03-12-2001, 09:37 PM
Cardinal Cardinal is online now
Charter Member
 
Join Date: Apr 1999
Location: 742 Evergreen Terrace
Posts: 5,945
Hey, that makes sense. We'll see if we can do that. Thanks for the tip.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:41 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Send questions for Cecil Adams to: cecil@chicagoreader.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Publishers - interested in subscribing to the Straight Dope?
Write to: sdsubscriptions@chicagoreader.com.

Copyright © 2013 Sun-Times Media, LLC.