Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 975725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:38:00+00:00 2026-05-16T03:38:00+00:00

A user can select a performance, so the performance elements have unique ID’s. I

  • 0

A user can select a performance, so the performance elements have unique ID’s. I want to basically say:

Select all reservations->reservation[‘seat’] FROM performances->performance[‘id=2’].

Hope that makes sense, I really am struggling with selections in simple XML.

Thanks in advance, Henry.

    <performances>
                <performance id="7" time="12:00" day="Monday" month="June" year="2010">
                    <reservations>
                        <reservation seat="a7"/>
                        <reservation seat="a2"/>
                        <reservation seat="a3"/>
                    </reservations>
                </performance>
                <performance id="8" time="12:00" day="Tuesday" month="June" year="2010">
                    <reservations>
                        <reservation seat="a8"/>
                    </reservations>
                </performance>
</performances>

Extra Info:

I am currently using: echo $xml2->show->performances->performance['0']->reservations->reservation['seat']

This gets one reservation from the first performance, but I want all reservations from the performance with the id of ‘3’ for example.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:38:01+00:00Added an answer on May 16, 2026 at 3:38 am

    Your “SQL”:

    SELECT reservations->reservation['seat'] FROM performances->performance['id=2']
    

    can be reformulated as:

    FROM performances->performance['id=2'] SELECT reservations->reservation['seat'] 
    

    can be reformulated as XPath:

    //performances/performance[@id=2]/reservations/reservation/@seat
    

    Ant that’s what you need. Look at SimpleXML’s xpath() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this PHP page where the user can select and un-select items. The
I have a View where the user can select Basic Configuration and Advanced Configuration
I have a segmented control where the user can select how to order a
I have a dropdown box where the user can select a method to check
I have the following select list from which the user can select multiple values.
I have a list of videos that a user can select from to watch.
I have a text to speech application where the user can select a language
I have a custom cell with a thumbnail image, which the user can select
In my app,user can select image from gallery and after that he can zoom
There is a common feature of modern browsers where a user can select some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.