<?php $recno = 7; $query = "DELETE FROM mytable WHERE field=$recno"; mysql_query($query) or die("Error: ".mysql_error()); $query = "SELECT * FROM mytable WHERE field>$recno LIMIT 1"; $result = mysql_query($query) or die("Error: ".mysql_error()); ?>
-----Original Message----- From: Zak Grant [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 6:08 AM To: [EMAIL PROTECTED] Subject: Next auto_increment value? All, I'm a little (lot!) stuck on generating what seems to be quite a simple query... Example: I have a table with ID as auto_increment It contains values 1 to 10 I delete #7 How can I, using MySQL, say "I have the number 6 - what's the next valid ID up/down from this?" I'm looking for, quite simply, "8" as a response. If I delete #8, I'd get "9", etc. Is this possible? Thanks in advance! And I hope MySQL will be coming back to the PHP International Conference this year :) ~ZG~ PS: Please excuse my English _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php