Re: How Best to Maintain Sort Order Field
| From: | Zoltán Németh | Date: | Fri, 20 Apr 2007 13:39:47 +0000 |
| Subject: | Re: How Best to Maintain Sort Order Field | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253337@lists.php.net to get a copy of this message | ||
2007. 04. 20, péntek keltezéssel 09.31-kor Stephen ezt írta:
> Opps. Sorry
>
> I meant when I create the category the category_order field is blank.
>
> I need a strategy to update/maintain then.
yes. I personally do it like when I insert a new record it gets one
bigger than the current max - so it gets to the bottom of the list.
and I provide buttons to move it up/down/top/bottom which do nothing but
adjust the order fields accordingly
greets
Zoltán Németh
>
> Stephen
>
> Wolf wrote:
> > IMO, you don't WANT to change that behavior. The category_id should
> > remain as a auto-fill field for the database itself, then just sort
> > the results of your categories by name or order instead of by id when
> > displaying out to the page.
> >
> > HTH,
> > Wolf
> >
> > Stephen wrote:
> >> I have created some PHP scripts that use MySQL to organize the
> >> photographs on my web site.
> >>
> >> They are grouped into categories and the table for categories has
> >> these fields:
> >>
> >> Category_id
> >> Category_order
> >> Category_name
> >> Category_description
> >>
> >> When creating a category, the category_id field is blank
> >>
> >> I want to create another form to allow populating and/or changing
> >> this field and then updating the database.
> >>
> >> I will select all category rows, dynamically build the form and
> >> update the database, of course.
> >>
> >> But the next level of detail is not clear to me.
> >>
> >> What should I make the form look like? Can I do it so that after the
> >> update order values will always go from 1 to n where n is the number
> >> of categories?
> >>
> >> Thanks
> >> Stephen
> >>
> >
> >
> >
>