Re: [PHP-DB] Category Listing

2003-09-22 Thread Peter Beckman
On Sun, 21 Sep 2003, Paul B. [pbcomm, aka WPD] wrote:

 Hi, i'm working on the site that involves a lot ot categories and subs there
 of ... The way i have things now is that the structure goes one sub deep ...

 Ex:
 PHP - Database
 PHP - Books

 in the DB it looks like:
 id 1 name PHP parent 0
 id 2 name Database parent 1

 this way its easy to show dinamicaly where the user is (PHP: Database) by
 prividing
 index.php?dir=1sub=1.
 What i want to do, is go 3 or 4 subs deep. I just wanted to get an idea on
 the best posible way of doing this.

 index.php?dir=2

 Then select * from DB where id=2
 that gives you

 2  Database1

 If parentid!=0
select * from DB where id=parentid (1 in this case)
push $name onto an array (database is now array index 0)

 Then you'll have

 1  PHP 0

 Know you know you are at the top.
push $name onto an array (PHP is now array index 1)

 Now just pop them off the array (PHP - Database - end of array)

Beckman
---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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



[PHP-DB] Category Listing

2003-09-21 Thread Paul B. \[pbcomm, aka WPD\]
Hi, i'm working on the site that involves a lot ot categories and subs there
of ... The way i have things now is that the structure goes one sub deep ...

Ex:
PHP - Database
PHP - Books

in the DB it looks like:
id 1 name PHP parent 0
id 2 name Database parent 1

this way its easy to show dinamicaly where the user is (PHP: Database) by
prividing
index.php?dir=1sub=1.
What i want to do, is go 3 or 4 subs deep. I just wanted to get an idea on
the best posible way of doing this.


Thanks
Paul B.

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