josh013
02-28-02, 16:04
| Ok, my first post here guys so please don't make fun of me too much:) So, I got this silly idea to be able to insert entries/rows into specific locations. For example: Let's say I have 3 columns $query = "CREATE TABLE lessons ( EntryID INTEGER AUTO_INCREMENT PRIMARY KEY, Title VARCHAR(30), Text TEXT)"; (This is how the table is setup now, but I understand I may be totally wrong in this setup...) These entries are displayed one per page in my application w/next and prev buttons. My question regards wanting to insert a new row between two existing. My idea is to create an "orderID" column to reference the rows display order (1,2,3,4, etc.) and write my "add" script to insert the newly created row between two existing, by referencing the "previous/above entry" the script would then add +1 that number assigning the position of the newly created row to follow the reference number, and add +! to all following numbered rows to ensure the correct order. So I'm probabally going about this half blind and back asswards, like you can't tell from the post I'm quite new to mySQL and PHP, any help Would be greatly appreciated. Thanks. JOSH |