473,499 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multi level SQL results into XML

Hi All;

this is not a specific PHP question, but as I am working in PHP....

My SQL queries return one, two, sometimes even three levels of XML
data.
So for orders in my system I would like to see in my XML:

<RESULTS>
<order>
<number>3213</number>
<date>Feb 03, 2003</date>
<product>
<name>NEC Monitor</name>
<quantity>3</quantity>
<serial_numbers>
<sn>12321312321</sn>
<sn>44314133422</sn>
<sn>43434343553</sn>
<serial_numbers>
</product>
<product>
<name>Genius Mouse</name>
<quantity>2</quantity>
<serial_numbers>
<sn>23232</sn>
<sn>44343</sn>
<serial_numbers>
</product>
</order>
<order>
<number>444</number>
<date>Mar 06, 2003</date>
<product>
<name>MS Keyboard</name>
<quantity>1</quantity>
<serial_numbers>
<sn>333333</sn>
<serial_numbers>
</product>
</order>
.........
</RESULTS>

obviously my query would reutrn

order_num order_date product_name quantity
serial_number
------------------------------------------------------------------------
3231 Feb 03, 2003 NEC Monitor 3 12321312321
3231 Feb 03, 2003 NEC Monitor 3 44314133422
3231 Feb 03, 2003 NEC Monitor 3 43434343553
3231 Feb 03, 2003 Genius Mouse 2 23232
3231 Feb 03, 2003 Genius Mouse 2 44343
444 Mar 06, 2003 MS Keyboard 1 333333

You get the point. I do not want to have 3 queries, but only one that
returns something like described above.

For now I have a functioin that does this, but the algorithm is not
the best, and it only works for two levels (so XML without the s/n for
example).
This must be a common problem, I would appriciate input as to how this
is commonly done, any pointers to web sites, articles... are all
welcome. I'd try to search the groups but for what?:) I would also
like to describe my current algorithm, but for now it seems I would
just bore you.

Looking for some input

Damjan
Jul 17 '05 #1
2 2309
Damjan wrote:

[snip]
My SQL queries return one, two, sometimes even three levels of XML
data. [snip] You get the point. I do not want to have 3 queries, but only one that
returns something like described above.

[snip]

You want a method of returning a sorted tree from SQL, right? Try this:

<URL:http://simon.incutio.com/archive/2003/06/19/storingTrees>

--
Jim Dabell

Jul 17 '05 #2
Jim Dabell <ji********@jimdabell.com> wrote in message news:<Iu********************@giganews.com>...
Damjan wrote:

[snip]
My SQL queries return one, two, sometimes even three levels of XML
data.

[snip]
You get the point. I do not want to have 3 queries, but only one that
returns something like described above.

[snip]

You want a method of returning a sorted tree from SQL, right? Try this:

<URL:http://simon.incutio.com/archive/2003/06/19/storingTrees>


That's a cool site, and I've read already some about that, but
unfortunately that is not what I need.

THanks anyway

Damjan
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

77
5207
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for...
4
19077
by: snowweb | last post by:
I am trying to implement a CSS hierarchical unfolding menu on a site. The thing is, it needs to be dynamically populated from the results of a database query. I previously had the menu working but...
23
5286
by: Kaz Kylheku | last post by:
I've been reading the recent cross-posted flamewar, and read Guido's article where he posits that embedding multi-line lambdas in expressions is an unsolvable puzzle. So for the last 15 minutes...
3
4596
by: jaddi1 | last post by:
Hi, I am trying to make a multi-level drop-down menu similar to what is seen here: http://www.cssplay.co.uk/menus/simple_vertical.html. My problem is that some of the menu will be populated from...
2
18314
by: kodart | last post by:
Introduction Performance is the main concern to most server application developers. That’s why many of them anticipate using .NET platform to develop high performance server application regardless...
6
1431
by: python | last post by:
I need to generate multi-level incrementing labels for an outline/hierarchy where the string for each level of a label is based on an incrementing sequence like 1, 2, 3 or A, B, C, or even I, II,...
4
10750
by: sharsy | last post by:
Hello, I have setup an Access Database which about 7 people can enter data into. We have had a few problems where a 'fairy' has mysteriously been changing data in the table that they're not...
6
3481
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
1
3573
by: nataraj2502 | last post by:
Hi, I have just configured my C# multi-threaded application from 32 bit to 64 bit platform for getting more memory support. But my application runs up to 40 - 50% slower as compared to 32 bit...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5468
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.