bogglemaster89 has asked for the wisdom of the Perl Monks concerning the following question:
Now as you may or may not be able to tell this aims to match the output from the database (in the @row) with the input from $usernameentered and $passwordentered.....and yes it kind of works......when run it returns user89 password12 but then it says......... incorrect username entered user89 incorrect password entered password12 These arent incorrect, they match just fine with whats in the database and the corresponding password. So whats gone wrong now masters, if only I could go a day without running into such errors.......it would be dreamy! OK I WANT THE PASSWORD ENTERED AND USERNAME ENTERED TO DISPLAY LIKE THEY ARE! HOWEVER I WANT TO GET IT SO THE INCORRECT.....BITS DONT DISPLAY AS I DONT THINK THEY SHOULD BE THERE.......MY QUESTION BEING HOW CAN I GET RID OF THIS AND SOLVE THIS BUG IN MY CODE? See a question now :-D bogglemaster89 bogglemaster89#!C:\strawberry\perl\bin\perl.exe use dbi; $usernameentered = "user89"; $passwordentered = "password12"; $dbh = DBI->connect('dbi:mysql:Database','username','password') or die "Connection Error: $DBI::errstr\n"; $sql = "select * from usertable"; $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (@row = $sth->fetchrow_array) { @username= grep /$usernameentered/, @row; print "@username\n"; @password= grep /$passwordentered/, @row; print "@password\n"; if (@username !=$usernameentered) { print "incorrect username entered @username\n"; } if (@password !=$passwordentered) { print "incorrect password entered @password\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl grep help!
by cdarke (Prior) on Mar 09, 2010 at 16:38 UTC | |
|
Re: perl grep help!
by Svante (Sexton) on Mar 09, 2010 at 16:43 UTC | |
|
Re: perl grep help!
by jrsimmon (Hermit) on Mar 09, 2010 at 17:09 UTC | |
by bogglemaster89 (Novice) on Mar 09, 2010 at 17:36 UTC | |
by chromatic (Archbishop) on Mar 09, 2010 at 17:42 UTC | |
by bogglemaster89 (Novice) on Mar 09, 2010 at 17:52 UTC | |
by marto (Cardinal) on Mar 09, 2010 at 18:05 UTC | |
| |
by jrsimmon (Hermit) on Mar 09, 2010 at 18:02 UTC | |
|
Re: perl grep help!
by Illuminatus (Curate) on Mar 09, 2010 at 16:26 UTC | |
|
Re: perl grep help!
by pemungkah (Priest) on Mar 09, 2010 at 23:15 UTC | |
|
Re: perl grep help!
by bogglemaster89 (Novice) on Mar 09, 2010 at 16:57 UTC | |
by cdarke (Prior) on Mar 09, 2010 at 17:03 UTC | |
by Illuminatus (Curate) on Mar 09, 2010 at 17:09 UTC | |
|
Re: perl grep help!
by bogglemaster89 (Novice) on Mar 09, 2010 at 16:36 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |