Skip to main content
December 18, 2006
Question

php + check password duplicate in database

  • December 18, 2006
  • 1 reply
  • 269 views
Hi I know Dreamweaver allow you to check for duplicate usernames but I would also like to be able to check for passwords.
I tried following the same as the username but it disregards it.
Any suggestions?
Thanks for your time.
This topic has been closed for replies.

1 reply

Inspiring
December 18, 2006
jjjhbj111 wrote:
> Hi I know Dreamweaver allow you to check for duplicate usernames but I would
> also like to be able to check for passwords.

It's not really necessary because the combination of the username and
password will still be unique. However, if you want to do it, you simply
need to create a recordset that uses the password as a filter.

Dreamweaver recordsets automatically create a variable that contains the
number of rows in the recordset. It's in the final line of the recordset
code, and looks like this:

$totalRows_recordsetName = mysql_num_rows($recordsetName);

You can then wrap the insert record code in a conditional statement like
this:

if ($totalRows_recordsetName > 0) {
$duplicatePass = 'Please choose a different password';
}
else {
// insert record code goes here
}

In the main body of the form:

if (isset($duplicatePass)) echo $duplicatePass;

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/