mysql auto_increment ends

wxdqz

New Member
Imagine a id field (primary key, bla, bla) tinyint unsigned with auto_increment.

The maximum number possible for the id is 255. So, if we write:

for ($i=0; $i < 255; $i++) {
...
query("insert into test value (NULLl, ...);
...
}

the last insert in this cycle will give a mysql error duplicate key:'255'...
this means that no more inserts will happen.

The only way out is to write a php function to read the id column and find the first available id (if we have anyone free at all).

Is there any other solution? A way to bypass this?

Thanks in advance.
 
Back
Top