GoldWyvern
6th August 2008, 04:51
I'm learning PHP day by day, and have created a few useful (to me) scripts all by myself without modifying someone else's code.
But I'm stumped. You see, I want a script to do a certain thing but I have no idea how to go about it.
I don't want people to write a script for me, I want to write it myself, so I will not be too specific. (but if you have example script I can examine and figure out, that would probably be easiest for me to grasp)
What I have, by example, is a text file. In the text is scrambled data.
1. The text file has repeating and/or non-consistent data. Matching words will not work. (preg_match)
2. The text file however, is always the same in that what I want is always on the same line, and is always only numbers.
3. I want to take the information from that line, but the numbers only (will be together) and put them in a variable.
4. The output would not have to be an array. It will be one block of numbers, say '58142'.
5. I would have to do it multiple times in the file, there are several lines I want to pull numbers from, BUT I do not want to do anything WITH it yet. I just want each instance in a separate variable (once I know how to do one line, I'm sure I could figure out how to do that)
What do I need then? Figuring out what function or set of functions would do this, and how that particular function works (an example, in other words).
Two weeks searching and I can't find one.
I'm only at the level of writing to text files right now, I don't have MYSQL experience. However, if MYSQL is best, mention it and how to input it into a database/table in MYSQL, and I will try it that way! :)
Thanks a lot. Even where to start LOOKING would be appreciated. (and don't say php.net, LOL - already looked there)
But I'm stumped. You see, I want a script to do a certain thing but I have no idea how to go about it.
I don't want people to write a script for me, I want to write it myself, so I will not be too specific. (but if you have example script I can examine and figure out, that would probably be easiest for me to grasp)
What I have, by example, is a text file. In the text is scrambled data.
1. The text file has repeating and/or non-consistent data. Matching words will not work. (preg_match)
2. The text file however, is always the same in that what I want is always on the same line, and is always only numbers.
3. I want to take the information from that line, but the numbers only (will be together) and put them in a variable.
4. The output would not have to be an array. It will be one block of numbers, say '58142'.
5. I would have to do it multiple times in the file, there are several lines I want to pull numbers from, BUT I do not want to do anything WITH it yet. I just want each instance in a separate variable (once I know how to do one line, I'm sure I could figure out how to do that)
What do I need then? Figuring out what function or set of functions would do this, and how that particular function works (an example, in other words).
Two weeks searching and I can't find one.
I'm only at the level of writing to text files right now, I don't have MYSQL experience. However, if MYSQL is best, mention it and how to input it into a database/table in MYSQL, and I will try it that way! :)
Thanks a lot. Even where to start LOOKING would be appreciated. (and don't say php.net, LOL - already looked there)