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 350599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:33:54+00:00 2026-05-12T11:33:54+00:00

I have functions in place that will convert the results of sql queries into

  • 0

I have functions in place that will convert the results of sql queries into XML. However, I now want to be able to, using PHP, read in an XML document (that has nested SQL statements), execute those statements, and essentially replace the sql statement with the results.

(Just a note, using PostgreSQL)

For example:

 <customers>
    <customer>
       <info>* from customer for where customer = 1</info>
          <details>
             <po>
                <info>* from po join where customer = "master" customer</info>
             </po>
             <order_history>
                <info>* from order_history where customer = "master" customer</info>
             </order_history>
          </details>
    </customer>
    <customer>
       <info>* from customer for where customer = 2</info>
          <details>
             <po>
                <info>* from po join where customer = "master" customer</info>
             </po>
             <order_history>
                <info>* from order_history where customer = "master" customer</info>
             </order_history>
          </details>
    </customer>
    ...
 </customers>

I am confident in reading in the XML document and querying the DB with the SQL statements, however I am not to sure how to go about populating the results in the XML structure.

Some sort of text replacement? Or simultaneously rebuild a duplicate XML document with results? Any suggestions? Thanks…

Also, these queries are correlated in the sense that the sub-queries (or higher level queries) depend on the lower level queries…

  • 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-12T11:33:54+00:00Added an answer on May 12, 2026 at 11:33 am

    This may not be what you’re looking for but I suggest not including SQL in the XML if you can avoid it. If your application grows you may end up wanting to use something else to store data (memcache?) and then you’ll have to write a SQL->(something else) translator.

    So, something more like:

    <customers>
      <customer id="1">
        <fetch />
        <details>
          <po>
            <fetch />
          </po>
    ...
    

    Then in your PHP you can parse the XML with the DOM methods. When you run across a customer tag you set the “current customer id”, remove the subordinate fetch tag, perform whatever query you want, add tags containing the results, and then move on down the tree to the next tags.

    When you hit the fetch tag inside the po tag you can fetch the current customer’s PO data, repeating the process above (remove, query, add tags).

    The output will contain the customer id in the same format as the input, making it easy to correlate output and input.

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

Sidebar

Related Questions

I have the functions in place that will render the drawing according to the
I have some functions in my Javascript code that will perform long operations such
I have functions that return an object, but I'm confused that should I return
I have functions that contribute to small parts of a figure generation. I'm trying
I have two functions that return simple strings. Both are registered. $.views.helpers({ parseDate: function
I have two functions that caluclate and adjust the height and width of elements
I have some utility functions like: void myVibratePhone() { AudioServicesPlaySystemSound (kSystemSoundID_Vibrate) ; } that
i have a vb.net GUIform that will display an AxWebBrowser to show a html
I have an enormous file of HTML that I'd like to convert to one
I'm using php to take xml files and convert them into single line tab

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.