Re: Re: php mysql problem
| From: | Richard Lynch | Date: | Wed, 03 May 2006 09:34:50 +0000 |
| Subject: | Re: Re: php mysql problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235336@lists.php.net to get a copy of this message | ||
On Tue, May 2, 2006 7:22 am, chris smith wrote:
> On 5/2/06, Ross <ross@aztechost.com> wrote:
>> This is my database now...I will use the item_id for the order but
>> what if I
>> want to change item_id 3 to item id 1? How can I push all the items
>> down one
>> place? How can I delete any gaps when items are deleted.
>
> Why do you want to do that? There's no benefit in doing this..
> actually it becomes a pain.
>
> You'd need to update not only this table but any field in other tables
> that references this one as well (and if you miss one, you have a
> completely useless database).
No, we've got past that bit.
Now he just wants user-definable ordering in sequence from 1 to N,
using item_id as the user-modifiable field, and "id" as the
auto_increment field.
item_id is a HORRIBLE name for such a field, mind you...
Call it "rank" or something, okay Ross?
While you are at it, "id" is an awfully generic name for a field, really.
I personally prefer:
create table foo (foo_id int(11) auto_increment, ...);
But, hey, a lot of folks go with just "id" on everything, and seem
okay with that. [shrug]
--
Like Music?
http://l-i-e.com/artists.htm