@Jurotek Thanks for the suggestion. It’s actually all solved now. The main cause of the problem was having the INSERT script in the same page I was displaying it. So every time I refreshed the page, it would substantially alter the increment value. After separating the INSERT script to another file, everything started working as it should. Thanks again.