In MYSQL
I have a table of subscribers where the primary key is the subscription number which is a column that does not have auto-increment, I can not change that. I made, in Codeigniter, a method that takes the next id for insertion like this:
SELECT MAX(incricao)+1 AS inscricao FROM inscritos;
This is done at the same insertion, I already have the ready object, so I put this value in the object and insert it in the database and it works.
The question is whether there is a way if you do this during insertion using the same codeigniter, php or sql. If it does not exist, by doing so I quote do I run the risk of two concurrent entries taking the same registration number?