LQHS Posted July 20, 2009 Share Posted July 20, 2009 Hi, I would need some help with this: http://lqhsadmin.byethost24.com/CHI.html On that page, I'd like to extract each player profile and order them in my mysql database (I'm already capable to handle PHP and MYSQL pretty well). However, I don't know how to achieve that goal. Maybe I would need Regex? Please if someone could give me a code how to do it it would be very appreciated. I must precise that the page is updated every day, so I will need to use the code you'll give me daily. I don't know if that info helps you in some way, but I prefer to tell you anyways... Thanks in advance! LQHS webmaster, Yan Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 20, 2009 Share Posted July 20, 2009 What do you mean you want to "order them in my mysql database"? You do not order records in a database - at least not how I think you mean. Is there a specific value you want the records ordered on (e.g. Pts, SH% or some other value in the database)? If so, you can always have the records ordered dynamically based upon the query you use to get the data. However, if you need the records ordered in some specific order that is not related to any data, then you would have to add a column to indicate the "order by" value. And then create new functionality for you to manually reorder as needed. I'm thinking you can go with the first option. Just show the query you currently use and specify how you want the records ordered. A simple change to the query should be all you need. Quote Link to comment Share on other sites More sharing options...
LQHS Posted July 20, 2009 Author Share Posted July 20, 2009 Thanks for your reply, However, what you see on that page was created by my simulator, an external program that generates HTML pages automatically. Si I don't have a query. And yes, I would like to have the Goals, PAsses, Points +/- ... The most important stats. I just don't know how to do what I want. I need to order and register my datas from the HTML page my game creates to my SQL database online. Is this clearer now Quote Link to comment Share on other sites More sharing options...
.josh Posted July 20, 2009 Share Posted July 20, 2009 If you created/control the stuff that displays this info, why not just write a script that specifically grabs what you need? For instance, have it insert the data into a table or flatfile when it is generated. Quote Link to comment Share on other sites More sharing options...
LQHS Posted July 21, 2009 Author Share Posted July 21, 2009 OK I think you don't understand that I'm not a game programmer, only a web amateur programmer. The game that generates the HTML files is encrypted and is installed on my PC's hard drive, so I cannot export only certain stats, you know...If I could do so my problem would have been solved a long time ago! All I need is a code that can scan that document and seperate into variables the different elements of each player's profile, so that I can register them in my database afterwards. But I don't know how to do the code that scans the entire document and puts into different variables the elements, and that's why I'm asking your help please! Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 21, 2009 Share Posted July 21, 2009 Is the page you linked to in your original post "THE" document you are getting the data from or is there a different document which you used to create the HTML page? If it's a different document, please attach the file. Also, there are two different tables - do you need the data from both tables or only one? Quote Link to comment Share on other sites More sharing options...
LQHS Posted July 21, 2009 Author Share Posted July 21, 2009 Is the page you linked to in your original post "THE" document you are getting the data from or is there a different document which you used to create the HTML page? If it's a different document, please attach the file. Also, there are two different tables - do you need the data from both tables or only one? The page you see is one of the 30 pages the program generates automatically. The 30 pages are built the same way, with the player stats and the profile of each one of them (for each of the 30 NHL teams). So, to answer your first question, yes this is the original page I am getting my data from. The page doesn't come from any other source (other than the game file in my computer harddrive). To answer question 2, I would need the data from the upper table, with the statistics in a chart, because the ones below are not so important. So only the upper chart containing the stats of each player. Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 21, 2009 Share Posted July 21, 2009 Ok, the process should be fairly strait-forward. If you want "help" on doing this yourself, then this is the place to get it. however, if you want soemone to "do it" for you then you need to post in the freelancing forum. You make the call. But, I can provide an overview of how I would accomplish this: 1. Read the file using file() so the results is an array with each element of the array as a different line of the file. 2. Create appropriate logic and egex expressions to extract the data for each column into a mutidimensional array. 3. process the array to either insert/update records in the database as needed Quote Link to comment 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.