Auto increment number in a textbox

Hi expert , any solution for me to generate auto increment number starting from 735/2018 in column  registration number of  textbox html.. then 736/2018 when new entry  is insert.
i wish registration number in my textbox can auto increment starting 735 then 736 ... so on
Yong Scott Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongSoftware Team LeadCommented:
suggest to have an ajax call to the backend script to grab the latest auto incremental number and display it into your textbox (or a div/span, etc in HTML), not only depends on client side scripting to make the auto increment. In addition, you may need to think for concurrency issues, such as if 2 different users logging in 2 different areas, what will be displayed etc.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chris StanyonWebDevCommented:
Few ways of dealing with this depending on your needs. Are you wanting the next number BEFORE you insert into the database, or are you happy to get it after the INSERT? Is the 2018 set in stone or would that change based on the year. If it's based on the year, does the 735/736 etc reset to 1 for the next year.

If the auto increment just carries on and you only need the ID AFTER the insert, then a simple Auto Increment field in your DB would be sufficient - it would be generated automatically when the record was inserted. This would take care of the first part of your number, and you could easily build the full xxx/2018 format when needed for display.
NerdsOfTechTechnology ScientistCommented:
Consider creating a timestamp column and an ID auto-increment column.

That way the ID's will continue to grow dynamically, while you can generate a sequence of {seq}/{year} based on a ROW_NUMBER() OVER() query easily.

seq/year AS bapreg, bapID, bapdate

2/2019, 52000, 1/4/2019
1/2019, 51999, 1/2/2019
400/2018, 51201, 9/2/2018
399/2018, 51200, 9/2/2018
612/2017, 50101, 11/15/2017
611/2017, 50100, 11/14/2017
NerdsOfTechTechnology ScientistCommented:
Information provided should help OP achieve goal. An autoincrement ID and date field can help create a composite ID of either row()-within-year/year, or simply id/year if sequential order in the year is not important.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.