Crew-Portal Posted November 12, 2007 Share Posted November 12, 2007 I sure am. Confused I mean. If I can take MySQL Run it through PHP and get XML why cant I do it the other way. <FlightPlans> <FlightPlan> <StatusText>Open</StatusText> <PlayerName>N350CA</PlayerName> <TimeFiledText>07:11 PM</TimeFiledText> <TimeOpenedText>07:11 PM</TimeOpenedText> <TimeClosedText /> <TimeOpened>07:11 PM</TimeOpened> <TimeClosed>09:53 PM</TimeOpened> <OpenTimeText>0d 2h 47m</OpenTimeText> <Plan>KDFW-KLAX, 737, 35,000'</Plan> </FlightPlan> </FlightPlans> ^^^ That is my XML code that gets updated twice per second. I need a code that can take the XML above and put it into a mysql table called flights. The colums that need to be filled with data is PlayerName, TimeOpened, TimeClosed, OpenTimeText, And OpenTimeText But I only want it to insert that information into the database if the StatusText == Closed, And I would like it to insert the data without a user needing to be on the website (But if a user needs to be on thats okay too) Can someone help me out and give me the code? I think it has something to do with explode and stuff? but im not exactly 100% sure, thats why I would be very appreciative if someone could just pend 5 minutes if they know how to write it. Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted November 12, 2007 Author Share Posted November 12, 2007 Bump Bump Bump! Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 12, 2007 Share Posted November 12, 2007 you can use the following tool (XML to array) http://www.phpfreaks.com/script/view/202.php once you got your xml in the a php array you could make a insert statement according to that Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted November 12, 2007 Author Share Posted November 12, 2007 When I do that it returns: http://24.76.166.219/index.php?page=xml So how in the world do I go about translating that gibberish into a SQL Query? All before the: [FLIGHTPLANS] => Array ( [0] => Array ( [FLIGHTPLAN] => Array ( [0] => Array ( Is just gibberish and I dont need it inserted into any database just the flight plans section of the XML, For all of you that want to know the full path to the XML is here Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 12, 2007 Share Posted November 12, 2007 So how in the world do I go about translating that gibberish into a SQL Query? Is just gibberish and I dont need it inserted into any database just the flight plans section of the XML, That ain't gibberish and you are contradicting your self. its a print_r of your array, just use a query and pick and choose the varibles you would like like $array['node1']['data1'] Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted November 12, 2007 Author Share Posted November 12, 2007 Okay I sorta get it but ould you do one quick thing. look at http://24.76.166.219/index.php?page=xml Now lets say I wanted to take the SERVERNAME out of that and put it in an echo statement how would I go about doing that? Because my array doesnt have a variable called $array as a matter of fact I dont even know what my array variable is called? Quote Link to comment Share on other sites More sharing options...
Crew-Portal Posted November 12, 2007 Author Share Posted November 12, 2007 Oh nvm there was a ['0']; in the array that I didnt see and that was the reason I couldnt echo the array! cooldude832 And rajivgonsalves You guys are awesome thank you so much, you just made me and a few members of my site very happy. Keep up the good work. You are great at what you do! Woot! Woot! Ya! Im so happy right now you just dont have a clue! Thank you! Thank you! Thank you! Nice work! TOPIC SOLVED!!! (Im Cryin' Im so Happy!) 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.