You automatically increase the number in the database when you define the table:
create table items (
item_id unsigned not null auto_increment,
. . .
);
When you insert an element, just insert all other columns except item_id:
insert into items(col1, . . . )
. . .
The database will set the value item_idto the new value when new values are inserted.
: . , :
SELECT LPAD(item_id, 8, '0')