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"; } }
In reply to perl grep help! by bogglemaster89
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |