Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-10-2008, 11:54 PM
stm stm is offline
Junior Member
 
Join Date: Jun 2008
Posts: 4
Default

Can anyone help me construct this query? In ad hoc php/ html programming I've had a query within a result loop. I'm sure it must be easier than this.

Any advice would be gratefully received.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:33 PM.