Ok, I have changed my code recently and started over,
It may not be the prettiest code, but its functional…
I have been working on this code for over a month, and cant come up with anything… Ill rewrite the code later to make it better, nicer looking and hopefully faster,
anyhow… here is my code…
[php]
echo “
”;
<?php
$query = "SELECT * FROM class_categories WHERE sub='0' ORDER BY cat";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
echo '
|
[/php]
now, of course Im working with categories and subcategories, and here is mysql schema…
DROP TABLE IF EXISTS `class_categories`;
CREATE TABLE `class_categories` (
`id` mediumint(8) NOT NULL auto_increment,
`sub` mediumint NOT NULL default '0',
`cat` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
DROP TABLE IF EXISTS `class_item`;
CREATE TABLE `class_item` (
`id` mediumint(8) NOT NULL auto_increment,
`cat_id` mediumint NOT NULL default '0',
`email` varchar(255) default NULL,
`title` varchar(255) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
`price` varchar(255) NOT NULL default '',
`uid` varchar(255) NOT NULL default '',
`d_start` varchar(255) NOT NULL default '',
`d_stop` varchar(255) NOT NULL default '',
`city` varchar(255) NOT NULL default '',
`zip` mediumint(5) NOT NULL,
`image` VARCHAR(30) NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Ok, with all this, what Im doing, is when a users comes to my site, and they see the main categories, with the main categories, I wanted to put how many items with each main category, plus each subcategory,
the code above doesnt have the subcategory links,
I have tried different code before, without the table column seperation… but thought if I had the subcategories listed with the main categories, they wouldnt have to see all of the items added together in just the main category, but I have so many subcategories with the main category, it fills up the entire page with just categories, so, just went back to having the main categories on the page, which is the code above, the table can actually be taken out, because, I can just make them a list on the main page…
any help with this would be greatley appreciated…