sql - MySql on duplicate key set last_insert_id is causing auto_increment to jump -


i have query goes follows:

insert table(columns) values(values) on duplicate key update id=last_insert_id(id) 

i use id of inserted or existing row of data.

$id=$connection->lastinsertid(); 

well have issue auto_increment jumping each duplicate key update.

enter image description here

i on duplicate key update part causing these jumps. source of problem? there way fix within query without reseting auto_increment entirely every time?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -