Re: php mysql comparing two rows in two columns for username and passwort

From: Date: Thu, 29 Apr 2010 13:00:04 +0000
Subject: Re: php mysql comparing two rows in two columns for username and passwort
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-47095@lists.php.net to get a copy of this message
Hi, Maybe try... $benutzername = $_GET['username']; $pass = $_GET['password']; $result = "SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'"; while($r = mysql_fetch_row($result)) { $dbbenutzer = $r["sqlbenutzername"];
        $dbpasswort = $r["sqlpasswort"];
}
       if($benutzername == $dbbenutzer && $pass == $dbpasswort){
         echo '<p>Sie haben sich erfolgreich angemeldet</p>';
         echo '<a href="willkommen.html">Willkommen</a>';
Karl On Apr 29, 2010, at 7:25 AM, Alexander Schunk wrote:
Hello, i am writing a small login script for a website. The username and passwort are stored in a database in two separate columns. I have it like this: 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>';
              }
        }
       }
Sice the values are entries in rows in two columns, i use mysql_fetch_row to get the entries. Then i want to compare the returned values of the sql statement with the values provided by the user. My problem now is only get the first value pair of username and passwort, not the second. For instance the first value pair is moritz 123456 which i get returned but i dont get returned the second value pair thomas thorr. thank you yours sincerly Alexander Schunk --PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Karl DeSaulniers Design Drumm http://designdrumm.com

« previous php.db (#47095) next »