(solved) String Search
Posted: Sun Aug 14, 2005 3:13 pm
I have a bit of code which allows user to cut and paste spying reports from an online wargame.
The reports are like this:
How would I search for the various keywords such as Gold Mine and assign the numerical value after each one?
Or is there an easier way to do it from the beginning, I did code it originally to make the user enter every single item separately in it's own field but the users don't like the workload! Cutting and pasting the whole lot and letting PHP do the work would be preferable, I assume it can be done?
I did look for a search string function on the PHP site but didn't get too far, I find it's above my level over there!
Thanks for any advice.
The reports are like this:
Currently I am storing the whole lot as a mediumblob in a mysql database. However to make the output more presentable and to allow extra functions, I need to assign each part of the report to it's own variable, for example I need to assign $gold_mine as 20 and so on.Espionage report
from 11.08.2005 22:54
Espionage successful!
Offence Units Gard (15:92:11)
Total Losses
Small Warship 1 0
Defence Units ^___^ (11:66:21)
Total Losses
Large Warship 3 0
Small Warship 9 0
Small Merchant Ship 8 0
Archer 45 0
Buildings
Main House Level 10
Gold Mine Level 20
Stone Quarry Level 20
Lumber Mill Level 20
Laboratory Level 15
Watch-Tower Level 8
Research
Spear Level 1
Shield Level 1
Bow Level 10
Catapult Level 10
Sail Level 10
Resources
Gold 2280
Stone 1034
Lumber 3989
How would I search for the various keywords such as Gold Mine and assign the numerical value after each one?
Or is there an easier way to do it from the beginning, I did code it originally to make the user enter every single item separately in it's own field but the users don't like the workload! Cutting and pasting the whole lot and letting PHP do the work would be preferable, I assume it can be done?
I did look for a search string function on the PHP site but didn't get too far, I find it's above my level over there!
Thanks for any advice.