Inserting a record in db and maintaining order

Codes here !

Moderators: egami, macek, gesf

Post Reply
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Wed Mar 12, 2003 3:00 am

you don't

there is no reason for wanting to store records in any order in a database - you should only want to manipulate the order when you pull the records out - using ORDER BY methods.
avatar image based upon nasas apod (only updates if I post though)

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Wed Mar 12, 2003 11:47 am

ORDER BY can reference any field, whether a key or not.

You should though have at least one index field in any table.
avatar image based upon nasas apod (only updates if I post though)

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

Wed Mar 12, 2003 5:42 pm

well you can ofcourse give the new entry the right id value and add one to the ids of the ones above (or the same) as the id you gave to the new value...it's shitty though.

Could you tell us why you want it like that? :) There must be something you order it by, because otherwise you couldn't tell where to put the new record :)

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests