Re: Checking database if already exsists
| From: | Johannes Janson | Date: | Mon, 16 Apr 2001 18:11:37 +0000 |
| Subject: | Re: Checking database if already exsists | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8607@lists.php.net to get a copy of this message | ||
Hi,
assuming you have unique passwords.
$result = mysql_query("SELECT COUNT(*) AS used FROM userTable WHERE
passowrd=$password");
$exists = mysql_fetch_object($result);
if ($exists->used) {
....display error that pswd is already in use ....
}
If there is an entry in your DB with the password the _fetch_object contains
"used".
You can do the same thing for username and e-mail.
Johannes
""DC"" <dave_news@NOSPAM-davecarrera.com> schrieb im Newsbeitrag
news:9bfam9$jlm$1@toye.p.sourceforge.net...
> Hi again
>
> How do i check my database when someone trys to become a member to check a
> see if
>
> username
> password
> email address
>
> is already in use and show the the bit they need to change for my script
to
> allow them to register.
>
> Thanks again in advance
>
> Dave C
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>