For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > April 2004 > Re: [PEAR] DataObject & Formbuilder self ref. tables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] DataObject & Formbuilder self ref. tables
Markus Wolff

2004-04-30, 3:07 am

Mike Carter wrote:

> [shopcategory]
> shopcategory_id = shopcategory:id
> shopimage_id = shopimage:id
>
> So a category can be nested within a parent category.
>
> My problem is the auto-generated form - the 'shopcategory_id' field doesn't
> get auto-generated as a select list containing all the existing categories
> in the table.


Hi Mike,

is the field shopcategory_id displayed at all? If not, you might have an
issue with the key order for this table - the key that's listed in the
[shopcategory__keys] section of your main .ini file is treated as the
primary key and will be rendered as a hidden field.

Other than that, I currently have no clue - self-referencing
relationships work like a charm for me - although: when you use them for
making a tree structure, you'll really *want* to write the code yourself
that fills the selectbox for the parent_id. Because if you don't, all
ID's will be listed as possible parents, even those that are lower in
the hierarchy than the node you're currently editing. If you choose such
a lower node as your parent, your tree structure becomes corrupt and the
tree can't be displayed anymore.

CU
Markus
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com