Jump to content

[SOLVED] print_r of table - how to get the actual values into variables?


Darla

Recommended Posts

Hello

 

I am kindof a newbie on this so bare with me.. I have used xml_parser to read some xml and put the values in an array using xml_parse_into_struct. This xml is stored in $results. I get the values when doing this: print_r($results); However, I'd like to get my hands on some of the simple values from the xml in neat variables so I can further put them into a db. I have tried accessing the values like this:

echo $results[0];

echo $results["boat"];

echo $results['boat'];

 

But all it returns is a simple 'A'. Great if someone could give me a tip on this.

 

Also, I am wondering what is the best way to fetch xml: xml_parse, DOM or simplexml?

 

Darla

Link to comment
Share on other sites

ahh I found it - seems it was set to the variable $results later - it was supposed to be a table but turns out it was a string, when I tried the originale table name it worked :) Sorry to have bothered you and thanks for helping!!

 

Btw: what do you prefer when fetching from xml? simple_xml, dom or parse_xml?

 

Have a nice evening!  :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.