How to check for duplicate usernames?

Admin admin at mfelkerco.com
Thu Aug 4 11:42:53 EDT 2011


  

I have a reasonably well working database now, however, you can
still duplicate usernames - my code is not working. I can gain access to
he database, no problem. 

I can write to and read from with no problem


Here, I just want to access the UserValidation table, grab all the
usernames and compare the current one in the password field to all the
ones in the database. If 

there's a match, then I want to tell them to
choose another username since it is taken. Pretty straight forward,
right? 

Here is my code: 

--find out if username already exists
 put
"SELECT UserName FROM UserValidation" into theUN
 put
revDataFromQuery(,,dbID,theUN) into theUNData

 if theUNData = the text
of field "fldUserName" then
 answer "Username already exists, please
pick another"
 exit to top
 end if

 if theUNData contains "revdberr"
then
 answer warning "There is an error "&theUNData
 exit to top
 end
if

Why is it not working? Could anyone with mysql knowledge take a
shot?

Mike

  


More information about the use-livecode mailing list