I'm not sure if what you mean is something like this: Say, you have a table with 2 columns (1) "id" and (2) "contact". And your table is populated in this way:
id contact 1 a 2 b 3 c 4 d 5 e And, let's say that your "id" is auto_incremented. Also, the contacts are shown ORDER BY "id" DESC. So, each time you add a new one, it shows up on the top of the list. So, what if you want a contact to show up between "id" 3 and 4? Well, what I'd do is (1) NOT auto_increment the "id" field and (2) "manually" increment the "id" by, say, 10 or 100. In other words, my table would probably look something like this: id contact 100 a 200 b 300 c 400 d 500 e So, if I want to make one contact show up between 300 and 400, I'll just add the contact with an "id" of, say, 350. This way, I wouldn't even need a "show_pos" field. Besides, I wouldn't even bother changing the "show_pos" for the other records. :) Of course, there must be a "more elegant" way of doing this. (Actually, I'm not really sure if I really understand your problem... Still, HTH...) - E > Dear guru's, > > Hit a problem while developing a CMS with php/mySQL. Part of this is a > contact list and this works ok (add/edit/delete with > insert/update/delete queries). Now the client has requested a new > feature: ability to change the order in which the contacts are being > presented in the public part of this CMS (don't ask me why). I've added > a field 'show_pos' to the contacts table and am able to change its value > when I edit an existing record or add a new one. What I can't wrap my > head around at the moment is how one deals with updating 'show_pos' for > the OTHER records (while editing/deleting present record (WHERE > id='$id')? Could anyone give me some pointers as to how this could be > done in php and/or SQL (preferable). I sure hope anyone understands what > I mean ... > > Cheers! > > newbie@a_loss > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php