Yeah! Thats a cool solution! ;) .ma Leif K-Brooks <eurleif@buyer-brokerage.com> wrote@22.04.2003 22:38 Uhr: > Thanks, my solution ended up being "SELECT MIN(id) as nextid FROM > puzzles where id > $completed" to get the next ID, and then "SELECT * > FROM puzzles WHERE id >= NEXTID_FROM_LAST_QUERY" to list the puzzles the > user can play. It relies on tje IDs being numbers with the higher > numbers being the later entries (which will most likely never change), > but at least it doesn't break with holes. > > heilo wrote: > >> Hi! >> >> Well there is another solution: >> >> SELECT * FROM puzzles ORDER BY primary LIMIT $completet, 1 >> >> But in this case the problem appeares to store this $completet -variable >> (may be using a cookie?) >> >> .ma >> >> >> >> Leif K-Brooks <eurleif@buyer-brokerage.com> wrote@22.04.2003 22:19 Uhr: >> >> >> >>> Yes, I thought of doing that. I'm thinking a better solution (if >>> nothing better can be found...) would be to store a hand-incremented >>> number seperatley. >>> >>> heilo wrote: >>> >>> >>> >>>> Hi! >>>> >>>> This problem seems to be similar to Raymond Lilleødegård's problem (subject >>>> of the emails: Inserting data without a reference in the row.) >>>> >>>> I suggest to add another column holding the number of the puzzles. >>>> Everytime >>>> you delete a puzzle or change something in the db you have to update this >>>> column to sustain the integrity of the numbers so that no holes come into >>>> existance (as you said it - it is not very good, that the primary key is >>>> more than a unique identifier, which should be his single job). >>>> >>>> Unfortunately it is not possible to add a second auto_increment so the >>>> moment you create this table you have to write a small proggie which >>>> numbers >>>> the rows... >>>> >>>> Hope this helps? >>>> >>>> .ma >>>> >>>> Leif K-Brooks <eurleif@buyer-brokerage.com> wrote@22.04.2003 21:55 Uhr: >>>> >>>> >>>> >>>> >>>> >>>>> I'm working on a puzzle game, where users must solve many different >>>>> puzzles. Once they complete a puzzle, they will be able to try the next >>>>> puzzle. Each puzzle is stored as a row in the puzzle in a database >>>>> table. The problem is, how would I select the puzzles the next highest >>>>> puzzle and lower? I could use a query something like "select * from >>>>> puzzles where id <= $completedid + 1", but it would break is there were >>>>> any holes in the ID. Also, it would use the ID as something more than a >>>>> unique identifier for each row, which is a bad thing. Any suggestions >>>>> for a better way? >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >> >> Matthias Steinböck >> Email: grillen@abendstille.at >> Web: http://www.abendstille.at >> >> Frühabendliches Webdesign. >> ------------------------------------------ >> Im Übrigen sind wir der Meinung, dass >> unsere Gesellschaft Gabel-diskriminierend >> Löffel verwendet. Alle Macht den Gabeln! >> >> >> >> Matthias Steinböck Email: grillen@abendstille.at Web: http://www.abendstille.at Frühabendliches Webdesign. ------------------------------------------ Im Übrigen sind wir der Meinung, dass Versicherungsanstalten das Recht haben Sollen kranke Menschen nicht zu versichern, Weil die so und so genug Geld haben. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php