How to check for duplicate usernames?

Admin admin at mfelkerco.com
Thu Aug 4 13:51:19 EDT 2011


  

Sorry to sound stupid, but after the select statement, how do I
then count for how many records got returned? 

Here's the select
statement you wrote with my variable: 

put "select username from
uservalidation where username = " &SQ &UN &SQ into CountUN
--count how
many records got returned. If greater than 0 you have a duplicate.


SQ's are single quotes and CountUN is the new variable

Do I put:

If
CountUN0 then

answer "Duplicate Username, please choose another
one"

exit to top

else

end if

Does that sound about right?

Mike

On
Thu, 4 Aug 2011 09:13:51 -0700, Bob Sneidar wrote: 

> On save, 
>
select username from uservalidation where username =count how many
records got returned. If greater than 0 you have a duplicate. 
> 
>
Bob
> 
> On Aug 4, 2011, at 8:42 AM, Admin wrote:
> 
>> 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
_______________________________________________ use-livecode mailing
list use-livecode at lists.runrev.com [1] Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode [2]
> 
>
_______________________________________________
> use-livecode mailing
list
> use-livecode at lists.runrev.com [3]
> Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
>
http://lists.runrev.com/mailman/listinfo/use-livecode [4]

 


Links:
------
[1] mailto:use-livecode at lists.runrev.com
[2]
http://lists.runrev.com/mailman/listinfo/use-livecode
[3]
mailto:use-livecode at lists.runrev.com
[4]
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list