Posts

Showing posts with the label codeigniter-3

Add prefix in my existing username PHP(Codeigniter)

Image
Clash Royale CLAN TAG #URR8PPP Add prefix in my existing username PHP(Codeigniter) I am trying to enhance my previous project. In the part of registration module I already done so far the validation of all fields(fields are: name, email, username and password),check if the email and username is already existing. Right now, I am thinking to add a suggestion for the user if the username is already existing by adding a prefix to the username. For example in creating a google account, if the username is already taken it will suggest that. See the example below. I almost got it but I think my code is wrong or missing something. Scenario 1: If user register existing username //Assuming all fields are filled Username: xxxx In my table it will look like this username: xxxx1 It is still correct but when the user tried now to register xxxx1 it will become like this xxxx11 instead of xxxx2 Question: Why my $counter didnt work? How can I increment the prefix and display it to my js? My Controller ...