| | |
Parse html
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2007
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
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?
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).
•
•
Join Date: Jul 2004
Posts: 494
Reputation:
Solved Threads: 21
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?
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?
www.uncreativelabs.net
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
![]() |
Similar Threads
- How to insert PHP in HTML language? (PHP)
- Need Help With HTML! (Site Layout and Usability)
- HTML parsing (Java)
- Web Crawler (Java)
- how to get url links (C++)
- WebCrawler problem (Java)
- HTML problems (Windows NT / 2000 / XP)
- XHTML Complient parser? (HTML and CSS)
- embPerl or PHP (Perl)
Other Threads in the PHP Forum
- Previous Thread: Need Help with converting an ID to a Name
- Next Thread: preg_replace
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary broken cakephp checkbox class cms code codingproblem combobox cron curl database date display domain dynamic echo email error file files folder form format forms function functions google href htaccess html image include insert interactive ip java javascript joomla js limit link load login mail malfunctioning menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion reference remote return script search server sessions sms source space sql syntax system table tutorial unset up-to-date update upload url validation validator variable video web webapplications websitecontactform youtube





