Many databases can handle hierarchical SQL statements.  For examples
oracle uses "START WITH / connect by".
eg.         SELECT         level L1, level_id, name
            FROM           company_level
                START WITH      level_id=21 
                                CONNECT BY prior level_id=parent_level_id


Very easy.  Let the database do all the work.  It would not be possible for
Yahoo to query the database recursively (ie issue many separate SQL
statements for a hierarchy).

So look into your database SQL reference.  Hierarchical queries are defined
in SQL99 but most databases are only SQL92 compliant with some custom SQL99
support.  I know DB2 supports hierarchies as well.

Mike
-----Original Message-----
From: Natasha [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 21, 2001 3:00 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Recursive Childs


Hiya,

This is something that I'm not able to figure out :

I am building something like a Yahoo! directry. I wanted to display a "new"
image infront of a category, like Yahoo! does.

But I want to show this even if the main category may not have any new link,
but a category in that might have, so like that...

like hotscripts.com too, so i thought if someone could tell me how to use
get all the children :

ID | NAME | PARENT
1    X      0
2    Y      1
3    Z      2
4    A      2
5    F      1
6    G      5
if i want to get all children of 1, i want to get 2, 3, 4, 5, 6!

how do i get this, thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to