2016-05-11, 01:20 AM
I want to rename a username if it is already exists.. By the way i'm implementing an auto register.
For example I have a variable which holds the username of a user (preferably his/her firstname).
--> $theusername = "Peter";
Now I would like to know first if ($theusername) is existing on the database. If its available, the user will auto register to the forum. If not, it will rename the username adding number to its username. So this is the process...
--> if ($theusername already exists){ //dont know the code here (any help?)
//register - i have my own code here
}
else
{
echo "Your username already exists, we will rename it to register you successfully.";
//rename the username (e.g. Peter1 or Peter2 if Peter1 already exists Peter3 and so on.) - I don't know the code here (any help?)
//register - i have my own code here
}
I'm experimenting this auto register but I can't start coding. Anyway, any idea will be appreciated. Thank you!
For example I have a variable which holds the username of a user (preferably his/her firstname).
--> $theusername = "Peter";
Now I would like to know first if ($theusername) is existing on the database. If its available, the user will auto register to the forum. If not, it will rename the username adding number to its username. So this is the process...
--> if ($theusername already exists){ //dont know the code here (any help?)
//register - i have my own code here
}
else
{
echo "Your username already exists, we will rename it to register you successfully.";
//rename the username (e.g. Peter1 or Peter2 if Peter1 already exists Peter3 and so on.) - I don't know the code here (any help?)
//register - i have my own code here
}
I'm experimenting this auto register but I can't start coding. Anyway, any idea will be appreciated. Thank you!