RE: [PHP] Recursive Childs
| From: | Krznaric Michael | Date: | Thu, 26 Apr 2001 16:04:29 +0000 |
| Subject: | RE: [PHP] Recursive Childs | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-50473@lists.php.net to get a copy of this message | ||
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:voidcore@yahoo.co.in]
Sent: Saturday, April 21, 2001 3:00 AM
To: php-general@lists.php.net
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net