MySQL database query passwort and username
| From: | Alexander Schunk | Date: | Thu, 29 Apr 2010 09:26:59 +0000 |
| Subject: | MySQL database query passwort and username | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-30057@lists.php.net to get a copy of this message | ||
Hello,
i am writing a login script with php and mysql:
while($dbbenutzer = mysql_fetch_row($sqlbenutzername))
while($dbpasswort = mysql_fetch_row($sqlpasswort)){
echo $dbbenutzer[$i];
echo $dbpasswort[$j];
if($benutzername == $dbbenutzer and $pass == $dbpasswort){
echo '<p>Sie haben sich erfolgreich angemeldet</p>';
echo '<a href="willkommen.html">Willkommen</a>';
}
}
}
I have the username=benutzername in one column and the
password=passwort in the oher column.
Now i use mysql_fetch_row to go through the columns and try to compare
the values given by sql select statement
with the values provided by the user.
The problem is that this code only finds the firs entry moritz and
123456 and not the second. There are two values in the database morith
123456 and thomas thorr. These are sample values for testing only.
Is there an easier way to write a login script?
thank you
Alexander