tags:

views:

66

answers:

1

hey i am having a real headache with this problem. I have a a menu, i am trying to pupulate it from mysql, this is my result from my sql

Axel - rubber - brake

Axel - rubber - nobrake

Axel - paste - brake

Wheel - rubber - brake

first row is first level of the menu and so on...

so right now the menu is full of duplicates, is there anyway to show them like,

axel - rubber

 -  paste

so you hover over axel and you get rubber and paste, i guess you can do it with multiple queries but is there some technique to use it with one result set?

hope someone has done this.

thanks

A: 

This is an issue for the code that reads from the database and then creates the menus.

When you read from the database, have an object that has the top level, so it would have two elements, axel and wheel.

Then the data structure should be able to contain itself, so it would have an array of it's own type.

Then you can have the axel object can have two objects within it, rubber and paste.

Inside the rubber object would be brake and no brake.

This rubber object is different than the rubber object within wheel.

Then you can display the information however you want.

The database just stores the data, it shouldn't be responsible for displaying it, IMO.

James Black