classic Posted August 11, 2008 Share Posted August 11, 2008 I need to check if a username already exists in the table. If yes is there a way to offer an altrenative based on the input Eg username classic classic4 exists Offer classic1 / 2 /3 /5 etc Any ideas Link to comment https://forums.phpfreaks.com/topic/119112-offer-username-script/ Share on other sites More sharing options...
waynew Posted August 11, 2008 Share Posted August 11, 2008 To check: $check = mysql_query("SELECT username FROM users WHERE username = '$username'"); if(mysql_num_rows($check) > 0){ echo "Exists"; } For username, how about a random string? $username = "user_".rand(1,90000); Link to comment https://forums.phpfreaks.com/topic/119112-offer-username-script/#findComment-613314 Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 You could use a random string like waynewex suggested. Or you can use a number of different methods. Like having an array full of different words then adding a random one to the end. But remember, you would also have to check if these names are already being used. Link to comment https://forums.phpfreaks.com/topic/119112-offer-username-script/#findComment-613356 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.