I have this table named “categories” with three fields as below
cat | order | id
--------|-------|----
News | 3 | 23
Hi-Tech | 2 | 15
Biz | 5 | 8
Health | 1 | 3
Also, I have another table named “links” like below
link | order | cat-id
--------|-------|-------
link1 | 2 | 23
link2 | 8 | 15
link3 | 5 | 8
link4 | 6 | 15
link5 | 2 | 15
link6 | 4 | 23
link7 | 1 | 3
link8 | 1 | 8
What I want to achieve is to sort categories and below each category to sort the links of that category cat-id / id like this below:
Health
link7
Hi-Tech
link5
link4
link2
News
link1
link6
Biz
link8
link3
I succeeded on showing the categories sorted but I am loosing it after it.
My aim is to show this on a page so I guess I have to use PHP and mySQL.
The query is simply this:
And here it is at work.
In order to show it on a page, it would look like this: