i'm making a weblog script and whenever i delete a post, there is a gap. for example, posts 1, 2, and 3. if i delete post 2, the order is 1, 3. is there a way to compact the database so there are no gaps?
What sort of database are you using? And, most databases, when you delete something DO remove the row. It's just the numbers are auto_increments (excuse spelling) which automatically add a new number. No two rows can have the same number, even if one has been deleted
Alex
i'm using a mysql database. i have phpmyadmin if that helps at all. for that example, say the order is 1, 3, 5. i want to change posts 3 and 5 to 2 and 3, respectively. so then the order would be 1, 2, 3.
Simple answer. You can't. Well, not unless you want to enter the numbers manually. If you have an auto incrememt column, it makes the number for you. No two rows can have the same number.
Why does it matter to you?