I need to generate a username with prefix start from 00000,so first user should be MS00001 and if reach 100,000 user will be MS100000.
the lastcustomers is query
SELECT * FROM customers WHERE id=(SELECT max(id) FROM customers)
My first idea is to query from my database and get the user id which have auto increment in mysql.
and +1 base on the return id in my input.
<% if(customers=="" ){ %>
<div class="form-group">
<label for="addMemberUsername">UserName</label>
<input value="MS00001" type="text" class="form-control"
name="addMemberUsername" placeholder="Username">
</div>
<% }else { %>
<div class="form-group">
<label for="addMemberUsername">UserName</label>
<input value="MS0000<%= LastCustomers[0].id + 1 %>" type="text"
class="form-control" name="addMemberUsername"
placeholder="Username">
</div>
<% } %>
but this hard code cant change the 10th record to become MS000010, how I make it to MS00010 and if reach 100,000 user will be MS100000.