I am wanting to add an incremented number to a mysql database table. The number should be different to the last number that was added to the database. Can someone please help me with this? I am stuck. Thanks in advance.
| SitePoint Sponsor |



I am wanting to add an incremented number to a mysql database table. The number should be different to the last number that was added to the database. Can someone please help me with this? I am stuck. Thanks in advance.


using "SELECT MAX(`number_field_name`) WHERE ..." to get the max number
and then insert a new record with MAX(`number_field_name`) + 1
* @location Vancouver, BC, Canada
* @name Steve
* @job PHP/MySQL, Drupal, WordPress Developer





Does an autoincrement primary key not suit your purposes?
Bookmarks