Do a search for Linked lists and double linked lists.
You may be able to do something like this.
Add two fields to your DB. These fields hold the Primary ID of the records on either side of the current record.
DB Feilds
(RECORDID ;INFO ;NEXT ;PREVIOUS)
(5 ;anything ;6 ;4)
(6 ;anything ;7 ;5)
(7 ;anything ;8 ;6)
(8 ;anything ;9 ;7)
Now if you need to move record 5 between 7 and 8 the only records you need to alter are the Next and Previous fields of record 4,5,6,7,8 or if you want to move 5 between 500 and 501 you will only have to change 4,5,6,500,501.
You can then index and sort based on the Next and Previous fields.
Just my 2 cents
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.