943,871 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2326
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Oct 8th, 2007
0

Re: Parse html

Take a moment and look at what will always be the same in your file.
1. Are the "fittings" from a standard set?
2. Is each blank line guaranteed to be there?
2a. What about line endings? (Does an EOL mean end of item slot?)
3. Can "fittings" go in a different place on your "vessel" or are they one position only?
3a. If they can go multiple places, does the order of the list matter?
1. The fittings are the selections of playes from a data base of >1000 items
2. yep. Each blank line sets the next slot
2a. as above
3. Each ship has ALWAYS 4 slots. High, med, low and rig slots, but the player doesn't have to use them all (there are a lot of crazy people in the game )
3a. Ther order of the slots in the file is, Low - Med - High - Rig (always).
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ramirez is offline Offline
6 posts
since Oct 2007
Oct 8th, 2007
0

Re: Parse html

Ok, now that I understand how your file is set up, I can offer some advice:

Your file relies on line endings and blank lines to seperate data. By looking for them and taking everything from the previous EOL+1 (end of line) to the current EOL you've got your item. (This is a string-centric view.)

Reading in a file makes this process easy. As you read each line, you'll have your items, or an EOL character. You can then do as you wish with the item (you may need to chop() it first) such as compare it to a list of items appropriate to the slot you're reading, or simply adding it to the appropriate place in the database. If it's an EOL, don't worry. The database accepts NULL values (unless someone used the NOT NULL option.)

Why don't you try it and see if you can do it now?
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Need Help with converting an ID to a Name
Next Thread in PHP Forum Timeline: preg_replace





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC