I'm doing a program in php, mysql and would like to generate a protocol with some argument.
The protocol would be automatically generated in the system, without user interference, however 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 logic below:
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 getting the current year of the last part of the protocol, example 2017, and if I did not return any lines it would start the protocol counter from 0001, once 2017 was written the counter would already have a line and it would continue the logical sequence, but how will I get the next number?