[thelist] manipulating rows in the result set with PHP help

Tom Dell'Aringa pixelmech at yahoo.com
Wed Dec 11 11:10:01 CST 2002


--- "Luther, Ron" <Ron.Luther at hp.com> wrote:
> Hi Tom,
>
>
> If the data is coming back the way you want, then using an "ORDER
> BY"
> clause can sort the records so they are easier to process.
>
> But ... are you sure that table is what you want?
>
> Do you really want to return:
> 'Lunch --- Side Order'
> 'Side Order --- French Fries'
>
> Instead of:
> 'Lunch --- Side Order --- French Fries'?

Actually I forgot the Order By..I added

ORDER BY
	categoryName, subcatname

Which changes the order they are listed. But that doesn't really help
me as I essentially need nesting.

What I want returned is:

Lunch (category)
 burger (menuitem)
Dinner (category)
 Specials (subcategory)
   spaghetti (menuitem)

etc. Sometimes a category will have a subcategory, and sometimes it
won't. Sometimes a category will have both subcategoryies and
menuitems, and sometimes it will only have subcats. I seem to have
the data I want in the results, its just the matter of figuring out
the display I am stuck on..

Again the sql and results page are at

http://www.pixelmech.com/test/results.html

It also shows at the bottom how I need the info displayed..

> -----Original Message-----
> From: Tom Dell'Aringa [mailto:pixelmech at yahoo.com]
>
> So let's say I'm on the second row of my result set (Lunch). Lunch
> has a subcategory of Side Order, and there are 2 rows of side
> orders.
> I'm on the second row of my result set in my $row =
> mysql_fetch_array($result), how do I at that point jump down a few
> rows, write out that info, then come back up? Doesn't seem
> possible,
> or seems I am thinking about this in the wrong way...


=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list