3
I am making a program in php, mysql and would like to generate a protocol with some argument.
The protocol would be generated automatically in the system, without interference from the user, but it would have to be the following standards:
Numbering: With each new registration he would have to increase the value and not repeat, following the following logic:
0001/ano --> 0001/2017
0002/ano --> 0002/2017
Another year would have to turn to 0001 again:
0001/ano --> 0001/2018
0002/ano --> 0002/2018
How could I implement this in the system?
I was thinking of taking the current year of the last part of the protocol, example 2017, and if it did not return any lines it would start the protocol counter from the 0001, as soon as it was recorded the 2017 the counter would already have a line and it would continue the logical sequence, but how will I catch the next number?
You are using Mysql as a database?
– rray
That’s right, php, mysql, Html5, JS
– Rafael Meirim
You can do this with the bank (it depends on a few things) or in the application. So I answer.
– rray