LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   need to get data from xml file to MySQL database, and then use php to access (http://www.linuxquestions.org/questions/linux-general-1/need-to-get-data-from-xml-file-to-mysql-database-and-then-use-php-to-access-404672/)

Armon 01-17-2006 07:23 PM

need to get data from xml file to MySQL database, and then use php to access
 
Hey, on this one game, there is a stockmarket. The data is uploaded into a XML file that is updated every 5 minutes. http://www.gewar.net/war/resources/xml/stockmarket.xml
From here I want to put it into a MySQL database. Hang on, then, I need to write a PHP script to take that data and create line graphs displaying the stock progess over a hour, day, and week. Which would be displayed in a webpage. I am not a complete newb, but please don't throw too many complex terms at me. I know its a lot, but thanks.

scott_R 01-18-2006 03:54 PM

Obviously, this isn't something where you can post a question and someone will be able to post scripts for what you need. That said, you'll be reading quite a bit, as you'll need to familiarize yourself with PHP and Mysql. PHP will be doing most of the work, so you'll need to learn how to connect to web pages and extract information from those pages, then reformat and insert that information into Mysql. After you've got that figured out, then it should be a relatively easy matter to essentially do that in reverse, to extract the information from mysql, and format it to display properly on your web server. For this, obviously, you should have a small bit of knowledge of apache, to set access permisssions and directory related items.

Alternatively, depending on what you need the data for, or how long you're storing the data, you might even be able to dispense with the mysql data, and instead just use a flat-file format to store the information. Obviously, this works better with smaller amounts of information (distrowatch.com uses flat files in this manner, so "small" is relative), or if you need to use the information in a lot of different ways (php might not have hooks for some programs, whereas mysql is fairly accessible by most, using various standard linking methods, but this is mostly if you need to expand your usage of this stuff in the future). And all these factors contribute to why someone can't just post an easy solution that would work for you.

Hope these links help get you started, and if you need more clarification on more detailed aspects of items you don't understand after reading this information, LQ's programming forum is a great place to get more help.

http://www.w3schools.com/php/default.asp
http://www.php-mysql-tutorial.com/
http://www.php.net/docs.php
http://dev.mysql.com/doc/


All times are GMT -5. The time now is 05:26 AM.