Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: DBI & MySQL Login Test

by SFLEX (Chaplain)
on Aug 25, 2009 at 08:58 UTC ( [id://791016]=note: print w/replies, xml ) Need Help??


in reply to DBI & MySQL Login Test

I would do it this way.
$uname = $dbh->quote($uname); $pword = $dbh->quote($pword); my $tablename = 'members_pass'; my @row = (); # no need for the if statement, we have asked that question in MySQL my $sth = $dbh->prepare("SELECT * FROM `$tablename` WHERE `username` = $uname AND `password` = $pword LIMIT 1 ;"); $sth->execute; @row = $sth->fetchrow; $sth->finish; print "@row" if @row;


Update: there was an error in the code. roboticus++

What did the Pro-Perl programmer say to the Perl noob?
You owe me some hair.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://791016]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-06-20 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.