Walrus
Walrus

Reputation: 20444

SQL / PHP sequential ID numbers

Is there a certain type of SQL field that acts as a sequential number increasing by 1 each time a row is added.

If not how do we find the highest number of a column with a PHP mySQL query and then increase it by 1.

Upvotes: 0

Views: 432

Answers (3)

Tino van der Laan
Tino van der Laan

Reputation: 291

You can make a field in a MySQL database increase by 1 for every new row by enabling the AUTO_INCREMENT flag. This is a very common (and very good) practice with identifiers within tables.

Upvotes: 1

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272517

You want an AUTO_INCREMENT field.

Upvotes: 3

Related Questions