OldWolf Posted April 1, 2008 Share Posted April 1, 2008 Hello all! I received such complete and useful answers to my last two posts that I had to return for another round. Thanks in advance for your help. I'm working on building an array based on an html file I have, and then will modify the data based on another text file. This code will be in a class for use with a load of different things for a system I'm working on, but the only part I really am struggling with is this portion. Essentially there's a seven column table with nearly 10,000 rows. I'd like to match each row to an existing SQL database row, using it's name, to modify the data in the database. All I need is to learn how to make each row an entry in an array and I can take it from there. The rows have a lot of css/html that I could remove, but it would take ages (and my software always locks up if I try to use a replace all type of command). It would be preferred if the php would simply recognize the <td> tag based on the <td portion, find the end of the tag, and know that that's the next column. Here's a shorter example of what I mean: <tr cssjunk="lots of attributes" moreattributes> <td lotsofcssjunk="junk!" more="morejunk">First data piece (the name)</td> <td otherjunk="wow this is getting old">First data piece (the name)</td> </tr> I wish to insert each row into an array, with an array of values equal to each columns values (numerical or associative array would both work). It's also useful to note I will be using this on a somewhat regular basis, so I'll be aiming for good error checking and good system feedback to make it easier to do this without much hassle Now to my main questions: 1. Is there an easy way to evaluate this huge amount of data? 2. What sort of checks would you recommend I insert? 3. Is there a way to have the code break the data up and do updates to the page to show the user where the parse is at? This shouldn't be that hard for me, but handling strings of text has never been something I was very good at (I guess this is the point where I change that!) Thank you! James Quote Link to comment https://forums.phpfreaks.com/topic/98938-solved-evaluating-an-html-file-and-a-text-file-to-place-data-into-an-array/ Share on other sites More sharing options...
OldWolf Posted April 3, 2008 Author Share Posted April 3, 2008 I worded this really poorly, didn't I? Let me try making it a little cleaner: Basically, all I'm trying to do is sort through a really huge html file that uses the above format. I'd like to take the entries in the HTML files, and get just the text from each row into an array. Each value of that array would be a single row of the data as an array. How would I go about doing that? Hopefully that makes a little more sense. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/98938-solved-evaluating-an-html-file-and-a-text-file-to-place-data-into-an-array/#findComment-508180 Share on other sites More sharing options...
devstudio Posted April 3, 2008 Share Posted April 3, 2008 This would best be done with regular expressions, I am not a regular expression guru, but I would recommend checking out the regular expressions forum on these boards. Best, Nathan Quote Link to comment https://forums.phpfreaks.com/topic/98938-solved-evaluating-an-html-file-and-a-text-file-to-place-data-into-an-array/#findComment-508195 Share on other sites More sharing options...
OldWolf Posted April 3, 2008 Author Share Posted April 3, 2008 This would best be done with regular expressions, I am not a regular expression guru, but I would recommend checking out the regular expressions forum on these boards. Best, Nathan Ha ha... well, I feel silly. Thanks, I guess I've never really used regex for anything, so for some odd reason it never occured to me... :X Thanks a bunch. Quote Link to comment https://forums.phpfreaks.com/topic/98938-solved-evaluating-an-html-file-and-a-text-file-to-place-data-into-an-array/#findComment-508218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.