Re: Reverse (or backward?) Infinity Loop
| From: | Simon Rees | Date: | Wed, 20 Oct 2004 11:42:15 +0000 |
| Subject: | Re: Reverse (or backward?) Infinity Loop | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36926@lists.php.net to get a copy of this message | ||
Hi Bruno
It looks like you're trying to do a hierarchical query. What database are
you using? If you're using Oracle you're in luck, see the docs for the
START WITH and CONNECT BY clauses of SELECT. I don't think many other
databases can do this so you would need to write code in your client
language to interpret the catParentId to catId relationship.
Simon
On Wednesday 20 October 2004 03:47, Bruno B B Magalhães wrote:
> Hi guys,
>
> I have a normal categories table:
>
> catId
> catParentId
> catName
> catStatus
>
> But I want when a user enters on:
>
>
> http://hostname/site/products/catId1/catId7/catId13/../../contentId.html
>
> A listing should apear like that:
>
> • Category 1
> • Category 7
> • Category 13
> • Category 2
> • Category 3
> • Category 4
> • Category 5
>
>
> A reverse (or backward) loop! We need to get the last category and then
> follow the ParentId until the 0 ParentId. Have anybody made this before
> (I hope so)?
>
> Many Thanks,
> Bruno B B Magalhaes
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simon Rees | srees@nildram.co.uk |
ORA-03113: end-of-file on communication channel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~