[KLUG Members] Inserting data into MySQL]

randy perry members@kalamazoolinux.org
07 Aug 2002 09:30:00 -0500


Yeah, I could post this to a SQL group, but I trust the noodledge in
this group. (Besides, I don't belong to any SQL list).

We need to be able to parse text files similar to the following:

<text data>
Judgment Spoiler List
Wizards of the Coast, Inc.
(Released May 21, 2002)

143 Cards Total
Color: 16 Black, 26 Blue, 33 Green, 27 Red, 33 White, 3 Land,
4 Multicolored

Rarity: 55 Common, 44 Uncommon, 44 Rare

Card Name:	Ancestor's Chosen
Card Color:	W
Mana Cost:	5WW
Type & Class:	Creature - Cleric
Pow/Tou:	4/4
Card Text:	"First strike When Ancestor's Chosen comes into play, 
		you gain 1 life for each card in your graveyard."
Flavor Text:	Empowered by generations of strength.
Artist:		Pete Venters
Rarity:		U
Card #:		1/143

Card Name:	Aven Warcraft
Card Color:	W
Mana Cost:	2W
Type & Class:	Instant
Pow/Tou:	n/a
Card Text:	Creatures you control get +0/+2 until end of turn. 
		Threshold - Creatures you control also gain protection 
		from the color of your choice until end of turn. (You 
		have threshold if seven or more cards are in your 
		graveyard.)
Flavor Text:	n/a
Artist:		Roger Raupp
Rarity:		U
Card #:		2/143
</text data>

Ok, the tags aren't going to be there, just what is in between them.  I
snipped it down to 2 to show you, but there are really hundreds.  There
are also a lot of other lists that each have a hundred or so records.

I know that it won't port directly, so I am looking for any solution of perl, php, whatever. The solution should format the text and precede it with insert into cards values(....whatever).  (php on webpage
PHP is preferred, but I could set that up as a front end to any solution.
Ideas??? Anyone?? Anyone?


Randall Perry