View Single Post
  #1 (permalink)  
Old 06-07-2008, 09:32 AM
stm stm is offline
Junior Member
 
Join Date: Jun 2008
Posts: 4
Default Stuck with query

Categories:
cat_id
parent_id
name
description
icon_url

This table manages my categories. Each category will point to a parent category unless it is on the top tier where parent_id = 0.

When I do a fetchAll(); I obviously get just a int for "parent_id". How can I change that into the associated name column?

cat_id, parent_id, name, description
0, 0, Top Level, NULL
1, 0, Animals, NULL
2, 1, Cats, NULL
3, 1, Dogs, NULL
4, 3, Jack Russell, NULL

I want to say that the category "Jack Russell" points to "Dogs" not 3.

Hope it makes sense, it's quite hard to explain.

Many thanks.

Last edited by stm : 06-07-2008 at 09:32 AM. Reason: formatting
Reply With Quote