Re: auto_increment

From: Date: Sat, 14 Apr 2007 09:54:07 +0000
Subject: Re: auto_increment
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43443@lists.php.net to get a copy of this message
Ron Piggott wrote: > Does anyone see anything wrong with the $query syntax? Ron > > mysql_connect(localhost,$username,$password); > @mysql_select_db($database) or die( "Unable to select database"); > $query="ALTER TABLE sessions auto_increment = '1'"; > mysql_query($query); > mysql_close(); The value would be an integer, not a string but that shouldn't cause a problem. To quote the docs: ALTER TABLE t2 AUTO_INCREMENT = value; You cannot reset the counter to a value less than or equal to any that have already been used. For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. It probably should be said that there is normally no reason to play with auto-increment values. Cheers -- David Robley An ulcer is what you get mountain climbing over molehills. Today is Prickle-Prickle, the 31st day of Discord in the YOLD 3173.

« previous php.db (#43443) next »