in reply to Re: Re: mysql auto_incremented id
in thread mysql auto_incremented id

The correct way to do this is with appropriate WHERE clauses.

For example to get the next row in the sequence:

select ... from the_table where id = (select min(id) from the_table where id > $last_id)
An alternative, with MySQL, is to use the LIMIT keyword. IIRC this should work (note - I'm not a MySQL specialist, so check for correct syntax):
select ... from the_table where id > $last_id order by id LIMIT 1
As you are limiting the result set to a single row, and will get next row in the sequence even if there are gaps.

Michael