I have been fighting with this issue for about 2 months now and I still have not found a solution.
I am very new to PHP/MYSQL so please be easy / patient.
Basically, I have a page, called "browse.php" - This page has a query, which selects * from table and lists the categories AS A TREE.
What I actually need it to do, is ONLY list categories with a parent of "0".
When one of these categories are clicked, it should take you to a new page (lets call this page browse2.php) which then lists ONLY the categories for the parent of "CATID clicked on browse.php)
MYSQL DB:
CREATE TABLE `categories_docs` (
`CATID` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(120) NOT NULL DEFAULT '',
`parent` bigint(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`CATID`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=utf8
BROWSE.php:
";
while ($row = mysql_fetch_array($result)) {
echo "".$row['name']." ";
}
echo "";
}
$result = mysql_query('SELECT * FROM categories_docs WHERE parent= 0');
echo "";
while ($row = mysql_fetch_array($result)) {
echo "";
}
echo "";
?>
I am really looking forward to one of you gurus being able to help me.
Thanks in advance!