mcfmullen Posted January 9, 2011 Share Posted January 9, 2011 You can ignore my previous thread: Xpath help. I made it needlessly complicated! Here's my problem: My array $selected contains: Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [buildingName] => EiffelTower [code] => lM [type] => building ) [requiredLevel] => 5 [cost] => 5000 [built] => 03/31/1889 [storageType => SimpleXMLElement Object ( [@attributes] => Array ( [itemClass] => EiffelTower_construct ) ) [defaultItem] => SimpleXMLElement Object ( [@attributes] => Array ( [amount] => 1 [name] => iron ) ) [finishedReward] => iron [image] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [loadClass] => mc [name] => construct_0 [url] => /buildings/eiffel_tower.swf ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [loadClass] => mc [name] => construct_1 [url] => /buildings/eiffel_tower.swf ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [loadClass] => mc [name] => built_0 [url] => /buildings/eiffel_tower.swf ) ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => icon [url] => buildings/eiffel_tower.png ) ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => startIcon [url] => /buildings/eiffel_tower.png ) ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => halfIcon [url] => /buildings/eiffel_tower.png ) ) [6] => SimpleXMLElement Object ( [@attributes] => Array ( [name] => completeIcon [url] => /buildings/eiffel_tower.png ) ) ) [constructionUI] => /buildings/Construct_eiffel_tower.swf [countryCard] => france ) ) I have the following code: echo "<td>".$selected[0]['name']."</td>"; echo "<td>".$selected[0]['code']."</td>"; echo "<td>".$selected[0]['type']."</td>"; echo "<td>".$selected['requiredLevel']."</td>"; This line of that code does not work: echo "<td>".$selected['requiredLevel']."</td>"; I've tried: echo "<td>".$selected[0]['requiredLevel']."</td>"; which also does not work. Can anyone help me figure out why?[/code] Quote Link to comment https://forums.phpfreaks.com/topic/223882-print-array-info/ Share on other sites More sharing options...
mcfmullen Posted January 9, 2011 Author Share Posted January 9, 2011 echo "<td>".$selected[0]->requiredLevel ."</td>"; I'm dismayed at the lack of help, but I did manage to get an answer elsewhere. Thank you anyway for looking! Quote Link to comment https://forums.phpfreaks.com/topic/223882-print-array-info/#findComment-1157158 Share on other sites More sharing options...
atrum Posted January 9, 2011 Share Posted January 9, 2011 Don't complain to loudly about not being helped with-in a spawn of only 5 hours. But any way, I think the reason nobody replied was the fact that your question wasn't clear enough. It sounded as though you were wanting help printing out the entire contents of the array, but from your last post you instead needed the contents of 1 element in the array. Quote Link to comment https://forums.phpfreaks.com/topic/223882-print-array-info/#findComment-1157194 Share on other sites More sharing options...
mcfmullen Posted January 9, 2011 Author Share Posted January 9, 2011 Seemed pretty clear to me that I was having problems with one particular line of code. In any case, it was a problem that persisted for 2 weeks (started in another topic) to which I've never had a response. I'm sorry for my comment, I didn't mean to come off as ungrateful. The people here are, in fact, extremely helpful and deserve a lot more credit than are given. Quote Link to comment https://forums.phpfreaks.com/topic/223882-print-array-info/#findComment-1157195 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.