krv123
asked on
Category sub category simple menu list
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
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)
ASKER
I dont understand object oriented any other suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Helo,
You can get a good idea if go through :
http://forums.devnetwork.net/viewtopic.php?f=1&t=92130
Regards.
You can get a good idea if go through :
http://forums.devnetwork.net/viewtopic.php?f=1&t=92130
Regards.
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.
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.
ASKER
Thanks
Following links will help you:
http://forums.whirlpool.net.au/forum-replies-archive.cfm/286199.html
http://bytes.com/groups/php/2702-simple-menu-mysql-query-question
http://bytes.com/groups/php/13101-mysql-php-dynamic-menu
Regards,