MySQL database query passwort and username

MySQL database query passwort and username

am 29.04.2010 11:26:59 von Alexander Schunk

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 '

Sie haben sich erfolgreich angemeldet

';
echo '';
}
}

}

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

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL database query passwort and username

am 29.04.2010 13:44:54 von Niel Archer

> 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 '

Sie haben sich erfolgreich angemeldet

';
> echo '';
> }
> }
>
> }
>
> 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?

You will get more answers asking your questions in the database mailing
list php-db@lists.php.net, rather than in a list for Windows related
matters.

> thank you
> Alexander
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
Niel Archer



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php