Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Category sub category simple menu list

Posted on 2009-04-15
6
Medium Priority
?
1,047 Views
Last Modified: 2013-12-12
Experts,

I am having issues display and <ul> <li> nav menu on my page.

Below is the table structure i have used. It pulls the information fine but when it comes to filtering it right I am stuck.
i need it to print:

hb_cat.title
<ul>
      <li>hb_sub_cat.title<li>
</ul>

buy each category title.

category 1
      sub category data
category 2
       sub category data
Thanks
/* table structure */
 
// category table
CREATE TABLE `hb_cat` (
  `id` int(10) NOT NULL auto_increment,
  `title` varchar(30) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
sub category table
CREATE TABLE `hb_sub_cat` (
  `id` int(10) NOT NULL auto_increment,
  `cat` int(10) NOT NULL,
  `title` varchar(30) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/* end table structure */
 
 
// Attempt sql statment #1
SELECT hb_cat.id AS cid, hb_cat.title AS ctitle, hb_sub_cat.id AS sid, hb_sub_cat.cat AS scat, hb_sub_cat.title AS stitle
FROM hb_cat, hb_sub_cat
WHERE hb_cat.id = hb_sub_cat.cat
GROUP BY hb_cat.id, hb_sub_cat.id
 
// Attempt sql statement #2
SELECT hb_sub_cat.id sid,hb_sub_cat.cat,hb_sub_cat.cat as scat,hb_sub_cat.title as stitle,hb_cat.title,hb_cat.id as cid FROM hb_sub_cat JOIN `hb_cat` on (hb_sub_cat.cat=hb_cat.id)

Open in new window

0
Comment
Question by:krv123
  • 4
  • 2
6 Comments
 
LVL 1

Author Comment

by:krv123
ID: 24150872
I dont understand object oriented any other suggestions?
0
 
LVL 14

Accepted Solution

by:
shobinsun earned 1000 total points
ID: 24157309
Hello,

Here is a very good tutorial for your need:

http://www.finalwebsites.com/tutorials/dynamic-navigation-list.php

Regards.
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
LVL 14

Expert Comment

by:shobinsun
ID: 24157452
Helo,


You can get a good idea if go through :

http://forums.devnetwork.net/viewtopic.php?f=1&t=92130

Regards.
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24159818
Hi,

Also look at the link below. Its a good tutorial about your issue:

http://crisp.tweakblogs.net/blog/317/formatting-a-multi-level-menu-using-only-one-query.html

Thanks and Regards.
0
 
LVL 1

Author Comment

by:krv123
ID: 24160513
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question