View Single Post
  #1 (permalink)  
Old Jul 31st, 2006, 02:10
AceTutor AceTutor is offline
New Member
Join Date: Apr 2006
Location: Australia
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Newbie needs help with Basic Sorting - How do I group items using say an id tag?

Greetings - I am a absolute newbie to PHP/MySQL and would appreciate kickstart help.

I have attempted a tutorial presented at DMX Zone but failed to make it work. You may care to see what I mean by looking at their site. I will add the link details once this posting has been accepted by your forum.

Here is my scenario
Basic Setup:

Database: MySQL
id Name
0 Fruit
1 Banana
1 Pineapple
1 Kiwi Fruit
1 Apples
0 Vegetable
6 Tomatoes
6 Peas
6 Carrots


Output required:
Fruit
Apples
Banana
Kiwi Fruit
Pineapple
Vegetable
Carrots
Peas
Tomatoes

Requirement:
Depending on the designated id, all items starting with 0 should display as bold category headings listed in alphbetical order and all associated products matching that category would be listed - also in alphabetical order.

Ultimately I will be changing the id column to a specific Products Part No. but the above example is consistant with the DMX Zones example and is simple (hopefully) to illustrate how I may achieve the desired output.

A working code sample - or suggested tutorial sites would be greatfully received

Thanks in anticipation


PS. I'm using Dreamweaver 8 / PHP / MySQL (latest versions)
Reply With Quote