RE: category and sub category traversal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hey vamvan...

you might pop this to the mysql email list as well, if you haven't already!

	mysql@xxxxxxxxxxxxxxx


-----Original Message-----
From: VamVan [mailto:vamseevan@xxxxxxxxx]
Sent: Monday, December 01, 2008 5:13 PM
To: php List
Subject:  category and sub category traversal


Hello,

I need some help in figuring out this logic.

I have two tables one for category and other for category_hierarchy.
category_hirerarchy has a column to determine the parent.

So the query I have to retrieve tree of one specific category is:

SELECT t.tid, t.*, parent FROM term_data t INNER JOIN term_hierarchy h ON
t.tid = h.tid WHERE t.vid = 16 ORDER BY weight, name;

The ones with parent = 0 is the top category

Now I need to prepare an associative array with parent child relation.

So bascially I need to retrieve [parentID] => array('childID', 'chidName')

Can anyone shed some light on the logic involved in preparation of this
array with out using multiple sql queries?

Thanks


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux