> I have a hockey database with players names in it and I want to be able to > update their stats one after the other. To be more clear - when the page > is > first entered I want the first players name to automatically appear > showing > his current stats (this will be in a form). Then you can update the record > and write it back to the database, then the next player will show up with > his stats showing, and the process continues until all the players have > been > done. Setting up the database and forms is no problem, but I'm not sure > how > I would keep count of what player has been done so the next one > automatically appears (and if there should be a power failure orWindows > crashes, or whatever else - I want the process to start at the last player > being updated - I don't want to have to start again from player one). I'm > not sure if this is more a PHP or MySQL question - or both - so I have > sent > it to both lists.
Each player has a unique number, right? Probably an auto_increment column? Use that to your advantage. SELECT * FROM your_table WHERE id > {$_COOKIE['id']} ORDER BY id ASC LIMIT 1 When you load the first player, $_COOKIE['id'] isn't set, so you'll get the player with the lowest ID number. Now you submit the form, process the data, and save the ID of the player you just edited into a cookie named 'id'. Now when you run the above query, you'll get the next highest ID number based on the last ID number you saved in a cookie. Keep track of the ID number in a cookie so that you'll always get the next ID whenever you come to the site. Have a method where you can "reset" the ID if you need to, also. Once the above query returns no rows then there is no one left to edit and you'll want to reset it also. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php