SaraLynn Posted September 7, 2006 Share Posted September 7, 2006 Hi,Can someone tell me how to make my register form check my MySQL database when someone signs upon my site to see if the username is available?. Currenly it has no error checking so the same usename can be registed over and over again.thanks so much,Sara Lynn Link to comment Share on other sites More sharing options...
aspnetguy Posted September 7, 2006 Share Posted September 7, 2006 before you insert the user into the database do a select statement to get a list of all the users in the user table. Then use a for loop to see if the provided username already exists in the return results array. Link to comment Share on other sites More sharing options...
reportingsjr Posted September 7, 2006 Share Posted September 7, 2006 or, you can do a select query to search the username from the database, get the result and use mysql_num_rows to see if that user name, is either 1, it exists, or 0, its open. That might be alot easier! Link to comment Share on other sites More sharing options...
aspnetguy Posted September 7, 2006 Share Posted September 7, 2006 or, you can do a select query to search the username from the database, get the result and use mysql_num_rows to see if that user name, is either 1, it exists, or 0, its open. That might be alot easier!Yeah that would be more efficient too. Link to comment Share on other sites More sharing options...
SaraLynn Posted September 8, 2006 Author Share Posted September 8, 2006 Thank you,With your input and php.net I got it.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now