recently the current project to initialize the data, it is a headache, and the database ID from increasing, to let the self-increment starting from 1: Then use the following method:
Method One: If none of the previous data is needed, you can simply empty all data and restore the self-increment field from 1 to counting
TRUNCATE TABLE name
Method Two: DBCC CHECKIDENT (' table_name ', reseed, new_reseed_value) The current value is set to New_reseed_value. If a row has not been inserted into the table since the table was created, the first row inserted after the DBCC checkident is executed uses new_reseed_value as the identity. Otherwise, the next inserted row will use New_reseed_value + 1. If the value of new_reseed_value is less than the maximum value in the identity column, a No. 2627-number error message is generated later when the table is referenced.
method Two does not empty the existing data, the operation is more flexible, not only can the self-increment zero, but also for the deletion of a large number of consecutive rows, reset self-increment and insert new data, or start from a new value, of course, can not and existing conflicts.
$sql = "Delete from $table _vote";
mysql_query ($sql, $link);
$sql = "ALTER TABLE $table _vote auto_increment=1";
mysql_query ($sql, $link);
Two methods for MySQL to reorder from 1 for self-increment ID