I need a little coding assistance for my new site (not related to HostMySite.com) so I thought I might post it here so all could benefit from the solution.
Problem: I'm creating a database application for trading cards, and I would like to populate the database WITHOUT manually inputting some 3000 odd card details. I've found a text file on the internet that lists all of the cards and most of the details I need, so I'm going to simply import them.
To do this, I need a perl script that performs the following:
1. Opens the text file and reads the information, which is in the following format:
Card Name: "Famous Deaths" Judges
Card Set: Monty Python Set
Card Color: B
Mana Cost: 4B
Type & Class: Creature - Judges
Pow/Tou: 3/3
Card Text: T: Put a +1/+1 counter on each black creature. Use this ability only when a creature is put in a graveyard from play.
Flavor Text: "We are proud to be bringing to you one of the evergreen bucket kickers."
Artist: Flying Circus, Episode 1
Rarity: U
Card ID: 30205043
Card Name: "Twit of the Year" Contest
Card Set: Monty Python Set
Card Color: Z
Mana Cost: 1WU
Type & Class: Enchantment
Pow/Tou:
Card Text: No spell with more than two words in its name may be played.
Flavor Text: "Now they're under starter's orders ... and they're off... Ah no, they're not. No, they didn't realize they were supposed to start."
Artist: And Now for Something...
Rarity: U
Card ID: 30205106
Card Name: [Goblin token card]
Card Set: Unglued
Card Color: X
Mana Cost:
Type & Class: N/A
Pow/Tou:
Card Text:
Flavor Text:
Artist: Pete Venters
Rarity: U
Card ID: 5503 |
2. Some of the information I don't really want (Artist and Card ID) but the rest needs to be added to a MySQL database through a DSN connection.
I can get into the specifics on the MySQL database later - that's under construction right now. Any suggestions offhand?