-3

I want to insert user IDs into a table in ascending order. So I want to make something like this:

insert last insert+1

Can anyone help me?

user unknown
  • 35,537
  • 11
  • 75
  • 121
  • 1
    Take a look at 'auto_increment' for your primary key. – ethrbunny Dec 15 '12 at 17:40
  • Try this. SELECT Auto_increment FROM information_schema.tables WHERE table_name='your_table_name' AND table_schema = DATABASE(); OR http://stackoverflow.com/questions/933565/get-auto-increment-value-with-mysql-query – Anup Yadav Dec 15 '12 at 17:43

1 Answers1

1

In phpmyadmin, there is an option the 'check' for a field being auto_incremented. You don't have to insert the ID, as it automatically does it on insertion of other data.

Please note that the ID column NEEDS to be a primary key!!!

Sterling Archer
  • 22,070
  • 18
  • 81
  • 118