List:General Discussion« Previous MessageNext Message »
From:Steve Ruby Date:February 16 2000 3:51pm
Subject:Re: Register
View as plain text  

Pankaj Ahuja wrote:
> 
> I need to have a system on my site where I ask people to register and upon
> registration, I send them a password. While filling in the registration
> form, the user has to fill in a username. I need to check for duplicate
> entries. How do I go about this?
> 

I dont' see why you can't just do 
select count(*) as entries from users where username = 'username they
entered';

if entries is zero then it is available. If not then it is in use. You
could
also make username a unique key and trap the error you get when you try
to
put in a duplicate and then tell them it is already in use.

> b)  Also, the members can login and change their profile. How can I check
> the username and the passwords and show them the desired record
> 

select <list of things you want> from users where username = 'username
they picked'
and password = 'password they entered'

this assumes you didn't encript the passwords and the properties you
want
are in the same table as the username and password, it may be more
elegant not
to do that.

If the query returns nothing then they entered the wrong username and/or
password,
simple as that.
Thread
RegisterPankaj Ahuja16 Feb
  • Re: RegisterSteve Ruby16 Feb