Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Thanked 0 Times in 0 Posts

    Lightbulb php array help needed

    Greetings. I'm working on a script to interpret XML output from a server script. I have a script that converts the XML into an array. The challenge I'm having is being able to retrieve data from the array based on how this array is created by the script. Here is an excerpt line of the output from the print_r command from $myArray which is the resulting array from the XML output.

    Array ( [XMLOutput] => Array ( [0] => Array ( [suggestion] => Array ( [@attributes] => Array ( [data] => my result here ) ) ) [1] => Array ( [suggestion] => Array ( [@attributes] => ... etc - continues this way for all records followed by )))))

    I was having trouble with the syntax but figured it out. For your reference if any of you have this same issue here's the answer:
    PHP Code:
    $myresult =  $searchResult['XMLOutput'][0]['suggestion']['@attributes']['data']; 
    Last edited by earthgrid; 01-16-2012 at 10:33 PM. Reason: figured it out...


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts