Hi everyone, this is my first time using daniweb, so helo!

I have a major issue with building a menu from a query.

I have the following, a query built from a join

from 4 tables

my query returns the following

Id cat name sub 2sub con

3 1 axle flat round 7
4 1 axle metal round 7
5 1 axle plas round 7
6 1 axle woo round 7
7 1 pod metal round 6
8 1 pod plas round 6
9 1 pod woo round 6

the con column identifies it as an axle or a pod.
each line is actualy supposed to be a link.

I have been trying to build somthing like this:

<div>
Axle
<a href=3>flat round </a>
<a href=4>metal round </a>
<a href=5>plas round </a>
<a href=6>woo round </a>
</div>

<div>
pod
<a href=7>......</a>
<a href=8>........</a>
<a href=9>.........</a>

</div>

the real query returns about a hundred rows formated the same way.

Is it possible to build a menu from this??

So far ive found 2 possible solutions ,

1. Ive found a few functions that create menus but they require a parent id and since my menu is built in various tables it wont work unless I redo everything.

2. Ive been trying out some arrays, but I cant get it working,

I am dieing here , has anyone faced a similar problem and can guide me???

thanks a lot.

i suggest

select * from `record` group by 'con' order by 'id'; 

and use the <ul> and <li>

say a query returns 100 entries

foreach($x as $y){
switch($y[2])


}
Member Avatar for diafol

Sometimes, you just have to bite the bullet and redesign your DB. If you show your DB design and explain what each field means, with what you wan to display, we'd all have a better idea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.